I start the tornado server with multiple processes:
server.bind(8000)
server.start(0)
Assuming I have a 4 processor system this should create 4 processes. For any client that connects I start a websocket (WS) connection. I want to be able to access websocket objects between processes because I may want to broadcast a message between client A on process 1 to client B on process 2. I have a mongo server and the solution i thought of was to pickle the WS for client 1 store it in mongo then get process 2 to retrieve this and unpickle then use the WS. However I don't believe picked objects can be shared between processes.
Can someone suggest the best way to share WS between tornado processes on a multi process system?
Thanks
Live connections cannot be pickled and stored in a database. Instead, each connection is owned by the process that first accepted it, and instead of passing connections around, you pass messages to the server that is handling a particular client.