1

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.

closed as too broad by Scant Roger, Ixrec, Bart van Ingen Schenau Nov 25 '15 at 10:21

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    socket.io on nodejs jumps out immediately as a good tool for implementing this on a Pi: socket.io/get-started/chat – Andy Oct 30 '14 at 12:04
  • Maybe checkout SignalR ;) – Knerd Dec 29 '14 at 1:06
  • To be clear if you just need WebSocket support you can just use the ws module. No real reason to use socket.io. – Sirisian Nov 24 '15 at 13:57
0

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.

0

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.