This is a simple websocket signaling server made for webrtc chess game.
the client side that deals with frontend and chess can be found in project called: chess-by-rookie-client
This is a code used for client's rewrite.tsx
I believe it is not needed since I can make sure that only one side creates offer and that the other creates only answer.
I have two users, one creates "game" the other joins, i don't see how it would cause both of them to send offer if one sends it and other recieves.
WebSocket was chosen
webrtc requires turn for Symmetric NAT.
In such case turn server just acts as a server and actual p2p does not happen. Is there point then in webrtc? If I can just use websocket server instead.
I guess complexity of software is smaller when you use turn server that isn't written by you, and using same webrtc functions when p2p and when not. As opposed to using webrtc for p2p and websocket when it is not p2p.
How to show dependency of something like a turn server that doesn't belong to nodejs?
such turn server would consume resources, it is important to make sure that it is used only for my chess.
See manual signaling in client. There are many issues with manual signaling, but it can be done.
'ready' -> 'offer' -> 'answer' -> 'icecandidate'
order matters.
There are additional steps in rewrite.ts, basically clients send message to server that they are ready, and when both are, only then server sends ready.
I have websocket as first step of connection. So as soon as both players are connected they can play.
This would create additional work for server. and it is kind of turn server.
User experience is much better this way.
If webrtc cannot be stablished, I have to continue sending state, since the game is in progress and I cannot just stop it in the middle because webrtc failed.
there is node tool that restarts app when it crashes.