Hacker News new | past | comments | ask | show | jobs | submit login

One thing to keep in mind is that when you LISTEN on a connection, you remove it from the connection pool until you are done with it. The straightforward approach of using one connection per connected client can quickly consume all of the connections in your connection pool and prevent you from handling additional requests.

What I’ve done for this in the past is to do all subscriptions over a single connection per server, and then have code in the server that receives all of the events and dispatches them internally based on a lookup table.




That's indeed what I do, the application has one LISTEN connection and distributes the messages over its connected clients.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: