The situation is I spin up a Rachet socket server with a shell script like this
$webSocketServer = new WsServer(new Chat());
$originCheck = new OriginCheck($webSocketServer, ['xdomain.com']);
$server = IoServer::factory(
new HttpServer($originCheck), 8080);
$server->run();
I have already a client side builtup that use AngularJs Websocket service. Till now its going fine.
Question As of now you can see i just manually run this script in terminal that run this server on port 8080.
But what i am trying to achieve is to create a user generated chatrooms.
In a sense that when user visits xdomain.com. He has a option to create a chat room. He clicks the button and it will hit my server. My server should create a new socket server for that user and give him a secret code/link. The user will send this code to his friends.
When their friends visit xdomain.com they will see two options
1 - Join room (they has to provide the code that they got from his friend) 2 - Create a chatroom (This will function the same way i described above)
Now I am not sure about this architecture. Is it good / bad / possible / impossible.
How many connection one Rachet Socket server will able to handle?
For every request to create a chatroom, my script will create a new Rachet Socket Server on a new available random port. Lets assume this site becomes very popular, will my vps able to open so many socket server on different ports? Do i have so many ports avaiable ?
Also,
On a single chatroom (Socker Server), Will users be able to transfer media files or its just text message that a Socket Server can receive?
Thanks