Hi, 

I just wondering what is a bullet-proof method to handle this situation:


I have several browsers that connects to the server via websockets (json 
messages) and i want to process all of them in a single thread.

I made this little demo <https://github.com/gale93/mmo-demo> for test but i 
dont like it. Its so dirty.
Once the connection 
<https://github.com/gale93/mmo-demo/blob/master/server/connection.go> is 
established the client 
<https://github.com/gale93/mmo-demo/blob/master/server/client.go> register 
itself into a map and then send all in-coming data to the packet channel 
where the "main thread" will read.


Now, one more thing i dont like is that i have to send through it not only 
the message but the client's info itself ( here's the definition 
<https://github.com/gale93/mmo-demo/blob/master/server/message.go>.  ) 
because i can't know who's sending it.



How should i handle a situation like this ? Is it one-channel-only for 
messages for all ruotines a good solution ? There are some articles I can 
follow to have an idea ? I dont know how to procede to improve the code.


Thx in advace,

P.s.: Sorry for my english, I wrote it fast from work ( !! ), I'll 
review/improve the question if its not that clear !


Have a nice day


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to