Piero V.

WebRTC on the server side with Pion and FFI

WebSockets and WebRTC

At the beginning of the year, I played a little bit with WebSockets and Rust. I tried to create a backend for a browser game implemented with Three.js.

However, things did not work very well. A friend and I did some tests, but his connection was underperforming, which is actually an advantage for testing. Its delays were very high, packets kept accumulating and being applied all at once. Moreover, I had implemented everything with unbounded queues. Therefore, the server program running on my PC occupied several GB of RAM at a certain point. Good thing we found all these problems soon.

The first suggestion you find when you start programming multiplayer games is that you should use UDP if you can. So, I finally decided to try WebRTC.

I soon discovered that WebSocket and WebRTC are completely different. The former is a protocol for full-duplex communication, usually between a browser and a webserver. The latter is a series of APIs for real-time communications, and spans from media capture, streams, screen sharing to data channels, which is the capability I was interested in. … [Leggi il resto]

Prosody, strophe.js e websocket

XMPP (Extensible Messaging and Presence Protocol), è uno standard nato nel 1999 per l’instant messaging col nome di Jabber. È stato usato ed è tuttora usato da moltissime compagnie: Google Talk non era che un servizio jabber, Facebook lo usava come API per la sua chat, Whatsapp usa un server jabber (ejabberd) notevolmente modificato.

Oggi questo protocollo può essere utilissimo alle app per smartphone e tablet: è stato disegnato apposta per l’uso in tempo reale e per essere esteso e i server XMPP sono testati moltissimo, quindi sono ottimi per il concetto di “Don’t reinvent the wheel”.

Inoltre, dopo l’introduzione delle websocket, è stato anche creato uno standard per usarle come canale per XMPP.

Lato server ho testato il server Prosody. L’idea con cui è sviluppato è la semplicità e la leggerezza: è altamente modulare, quindi si possono abilitare solo le funzionalità necessarie, ed è scritto in Lua, un linguaggio molto leggero e performante. … [Leggi il resto]