I own a Raspberry Pi and would like to use it as some sort of websocket relay, so that all people who visit a specific webpage would be able to communicate with each other. The key thing about this is that I want to define my communication protocol in Javascript on the client side. (IE: The messages that clients send to each other)
Are there any strategies for accomplishing this? Is such a relay already available via some sort of Apache extension (or similar)? Knowing C#, my first thought is to develop a C# service application that would run on top of Mono on the Pi. Does that sound like a good idea?
In my specific case, I’m looking to create a HTML5 multiplayer game. I know there are blindingly obvious cheating issues with my proposed implementation, but please keep in mind that this is an experiment, not something serious.
3
Not sure if it will help you but I have been developing a multiplayer HTML5 game for about 6 months now and I use C# as a server with Alchemy websockets. Alchemy seems like a stable library only gotcha I have found is it uses a timeout value that if set too low will disconnect the clients but not tell the client they have been disconnected which will throw an exception if that client tries to send data after that. The C# client actually uses a ping/pong and doesn’t have this glitch only the Javascript clients do. I got around this glitch by setting the alchemy timeout to 10 minutes and running a background thread on the server that goes through all connected clients and sends a “ping” packet that the client watches for and responds to and it keeps the connection open with no exceptions (have tested this on a server running for a week with 3 clients connected for a week)
Alchemy does run fine under mono which is why i chose it as I’m not decided yet wether the game server will run on a linux server or windows server yet.
Just my 2 cents on your idea.
See this tutorial on a NodeJS/JavaScript client chat application to give yourself a starting point. I don’t know if there is a FOSS chat application like this one written in C#, but if you are most comfortable in C# it might be worth doing some research to see if you can find something comparable to this Node solution.