Django Channels vs Socket.io for online card game - websocket

I want to develop a django app where few players connect to a room and then they can play different card games, for example poker. I decided to use websockets or something like this. So my options are django channels in server and websockets in client or socket.io in client and socket.io implementation for python.
I was looking for some comparison between them but most of the posts are pretty old. So what are the benefits and downsides of both?

Related

twilio <stream> websocket streaming to signalR asp.net core 3.0

Sorry if this is a silly question. Has anyone managed to get the twilio stream to websocket working with SignalR (https://www.twilio.com/docs/voice/twiml/stream).
I have been trying for a while now and although I can see its hitting the server I never see it hit any of the methods.
Any help would be greatly appreciated
Thanks
Steve
I am just taking a look at Twilio Streams now that they've announced bidirectional support, I noticed that the docs indicate you have to utilize WebSockets. SignalR uses WebSockets but isn't just WebSockets. It's summed up succinctly in Jim Mc̮̑̑̑͒G's blog post How to save an audio file from Twilio Media streams to Azure storage
"SignalR is terrific, but it solves a different problem. SignalR can be thought of as a wrapper of several technologies - of which WebSockets represent a major component. It primarily serves the purpose of connecting web-browser clients to a back-end service. Other problems it solves include the maintenance of robust connections and the use of fallback techniques to enable browsers that don’t natively support WebSockets, to still benefit from real-time connections.
For Twilio Media Streams, we need to use WebSocket connections in a server-to-server configuration. SignalR isn’t the right tool for that job."

How to use Pusher API for bi-directional communication?

When taking a look at the Pusher Servcer and their Client / Server API I am having some problems trying to figure out how Pusher will help me allow bi-directional communication between devices / apps.
I am having multiple smaller devices / apps in the field that should return their status to a server or another client, which acts as a dashboard to browse all those devices and monitor status, etc.
In my understanding this can be done using traditional WebSockets and a cloud-server in between which manages all connections between those clients - something I though Pusher would be.
But after reading through the docs I can't really see a concept of bi-directional data communication. Here's why:
To push data to the clients I have to use one of Pushers Server Libraries
To receive that Data I have to use one of Pusher Client Libraries
This concept however does not fit into what I need. I want to:
Broadcast to Clients.
Clients can send Data directly to Clients (Server acting as Gateway / Routing).
Clients can send Data to Server.
Server can send / response to unique Client.
When reading about Pusher, they state: "Bi-Directional Communication" which I currently cannot see. So how to implement that advertised Bi-Directional Communication?
Pusher does PubSub only. Using this, you can simulate bi-directional communication: Both sides of the conversation each need to have a topic dedicated to the conversation, and you then publish to this.
This is not ideal. For something which is probably closer to what you seem to want, take a look at WAMP (Web Application Messaging Protocol), which has more than just PubSub. There is a list of implementations at http://wamp-proto.org/implementations. For a router I would recommend Crossbar.io (http://crossbar.io), which has the most documentation to help you get started. Full disclosure: I am involved both with WAMP and Crossbar.io - but it's all open source and may just be what you need.

Is socket.io the WebRTC or WebSocket or something else?

I'm new to socket.io. In Realtime (Web) Applications, we used to choose whether it should be WebRTC or WebSocket (or even SIP, still?) technologies.
What exactly is socket.io in this case please?
WebSockets
socket.io is a popular open source library implemented on both backend and client side. This library is based on WebSockets API which allow a communication between a SERVER and a CLIENT.
WebRTC
On the other hand, WebRTC is a WebAPI which comes with basically 3 things:
Real Time Communication between two browsers (no server needed), a peer to peer connection (P2P)
Media Streaming (Audio and Video)
Real Time Communication Data Chanel (stream any data on P2P)
The main difference is that WebSockets needs A SERVER and it is based on publish/subscribe pattern where you can send raw data back and forth, without having any special data handling by default. In contrast, WebRTC has a lot of functions already in place which can be used to handle Audio/Video streaming and also the raw data with data chanel.
For more info I recommend reading on MDN links I provided above and also check this very cool slides on sockets and webRTC
If you want to make video or audio communication services use WebRTC for browser build in support and write the discovery and signaling. webrtc have awesome features like P2P connections and data encryption.
WebRTC client side (browser) features like get video and audio data with good support in evergreen browsers: http://iswebrtcreadyyet.com/#interop
And socket.io is good for build centralized pub / sub apps like text chat
You can make connections with WebRTC without socket.io but both works fine if you use socket.io for help in signaling

What is the relationship between ws engine.io and socket.io

This question basically makes it sound like the node library Socket.io uses the library engine.io which uses ws.
What role do each of these play given that each one can independantly create a WebSocket connection?
Look at Introducing Socket.IO 1.0 - New engine to see why they made Engine.IO.
Engine.IO has all the browser hacks and different things for compatibility, and has modularised the Socket.IO codebase.
You are correct that Socket.IO uses Enginge.IO which uses ws.
Engine.IO takes care of the connection and browser hacks.
ws is used when upgrading to websockets.
Socket.IO handles:
setup/connection to http.Server. (but engine.io has this as well)
list of clients
rooms
namespaces
decoding/encoding of Socket.IO packet format

Slack RTM API Connecting to Multiple Servers

I'm looking at creating a bot for Slack that can be installed across multiple different Slack communities. Slack offers a Real Time Messaging (RTM) API that creates a web socket per community to manage. Are there any best practices in Ruby for connecting to multiple web sockets concurrently? Is this something EventMachine or Celluloid should be used for or do clients exist that allow connecting into multiple bots? Thanks!
Here's a detailed post on "Writing a Slack Bot Service in Ruby": http://code.dblock.org/2015/11/14/writing-a-slack-bot-service-for-multiple-teams.html
You should use EventMachine or Celluloid. Either will work. A lot of the ground work has been done for you with a fully running sample in https://github.com/dblock/slack-bot-server.
Update: A more complete example can be found https://github.com/dblock/slack-gamebot which is the service that powers http://playplay.io, a Ping Pong, Chess and Pool Slack bot.

Resources