Prem
Prem

Reputation: 5997

Client-Server architecture behind chat applications using socket.io

I am learning socket programming using socket.io module. I couldn't understand the client-server architecture behind the application programmed using socket. For example, A is chatting with B using a chat application, both A and B are hosts similar to peer-to-peer architecture.
Where does the server come into this picture?

Upvotes: 0

Views: 240

Answers (2)

phra
phra

Reputation: 1

there is no peer-to-peer connections with socket.io. all the communications are managed server-side and you can have different namespaces and rooms. for more info look here.

there are different transport protocol that you can use, such as HTTP or WebSockets.

if you want to scale up the machines using a load balancer be aware that you have to implement a sticky session load balancing. for example you can use the ip_hash option of nginx.

Upvotes: 0

Izio
Izio

Reputation: 398

A will be connected P2P to the server. B will be connected P2P to the server.

So when A send a message, the server print it out to all other client (B in this context). Exacly the same for B.

A and B arn't connected each other. But you could do it.

Upvotes: 1

Related Questions