Questions tagged [em-websocket]

EventMachine based WebSocket server

EventMachine based, async, Ruby WebSocket server.

Link to Github

52 questions
7
votes
1 answer

How to implement websocket-based push service through Rails?

I'm building a messaging app like WhatsApp. My goal is to expose only REST API through Rails and "push notifications" to connected clients via websockets. So clients communicate with server only with the REST API. Only the server sends data through…
user1170896
  • 719
  • 1
  • 7
  • 19
7
votes
2 answers

Large number of WebSocket connections

I am writing an application that keeps track of content pushed around between users of a certain task. I am thinking of using WebSockets to send down new content as they are available to all users who are currently using the app for that given task.…
dineth
  • 9,822
  • 6
  • 32
  • 39
7
votes
1 answer

Safely stopping em-websocket in rails on thin

I have a rails app I am running on thin server to utilize the EventMachine run loop. The problem is that I would like to be able to include em-websocket to process information coming in from a ws and stop and start the websocket without stopping the…
MobileOverlord
  • 4,580
  • 3
  • 22
  • 30
4
votes
2 answers

Accessing a variable within a rails thread

I'm building an application for a web-based slide show, where one 'master' user can move between slides and everyone's browsers follow along. To do this, I'm using websockets and Redis for a global channel to send messages through. Each client who…
volx757
  • 163
  • 1
  • 2
  • 19
4
votes
1 answer

EventMachine and em-websocket - reading from a queue and pushing to a channel

I'm using eventmachine to read from a HornetQ topic, push to a Channel which is subscribed to by EM websocket connections. I need to prevent the @topic.receive loop from blocking, so have created a proc and am calling EventMachine.defer with no…
Barry Jordan
  • 2,666
  • 2
  • 22
  • 24
4
votes
2 answers

Is there a stable, production ready library for ruby for websockets?

I've been using Socket.io with node.js for some time, but I'd really love to do this in Ruby. There seem to be some projects available, but most of them are dead, namely: danthes - fork of Ryan Bates' private_pub cramp - no activity for the past 9…
Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327
3
votes
1 answer

How to send data in some format (JSON/XML/etc) from server to client by using web-socket

By following example from em-websocket gem, I've just create simple echo-server that running with Sinatra framework. The problem is I don't understand how to use some format to send message instead of plain text. For now, the code looks…
evfwcqcg
  • 15,755
  • 15
  • 55
  • 72
3
votes
1 answer

Establish a WebSocket connection in HTTP server (Sinatra Stream) in Ruby

I write a HTTP server (A) using Sinatra::Streaming (I use Ruby). It needs to read data from a WebSocket server (B) and forward it to a client (C). The data flow is "B-->A-->C". The read and write operations should be in real time. As a possible…
Hangchen Yu
  • 325
  • 3
  • 12
3
votes
1 answer

Scaling multi-channel pub/sub via web-sockets

I have been looking into this gist which provides a minimal functional implementation of channelled pub/sub style communication over websockets. For multiple channels we can have a local hash of EM::Channel instances which can be created on the fly…
lorefnon
  • 12,875
  • 6
  • 61
  • 93
3
votes
3 answers

em-websocket gem with Ruby on Rails

I started developing a web-socket based game using the em-websocket gem. To test the application I start the server by running $> ruby server.rb and then I just open two browsers going directly to the html file (no web server) and start playing.…
carpamon
  • 6,515
  • 3
  • 38
  • 51
2
votes
1 answer

Websockets - Guaranteed full Messages?

When an "onmessage" event fires in the web socket protocol are you guaranteed the full message or is it more like a straight TCP connection where you buffer the data first and then try to extract packets.
Mike Neumegen
  • 2,436
  • 1
  • 24
  • 39
2
votes
1 answer

Chat made with Event Machine Websocket on rails, running thin worked in development but not production

I created a live chat on a rails application and I am using EventMachine to run a Websocket to have live chat. The live chat works on localhost on several machines. It also worked on an Amazon EC2 instance in development on ubuntu, but when I tried…
2
votes
1 answer

How to broadcast or make connection in em-websocket?

I am using the em-websocket to make communication for clients (may 2 or more users). In their introduction . https://github.com/igrigorik/em-websocket I want to modify their simple echo server example to achieve my purpose. but in their example ,…
Sirius Wang
  • 339
  • 1
  • 5
  • 15
2
votes
0 answers

EventMachine::WebSocketClient.connect causes onclose to trigger on server side

There are three parts in my Rails application: A part which listens for HTML5 web sockets (em-websocket) a piece of JavaScript which connects to them and a part which task is to connect to these sockets from inside of the same web application…
Paul
  • 25,812
  • 38
  • 124
  • 247
2
votes
0 answers

How to close websocket and release a port

I have websocket opened under a certain port, and when the client web browser closes, I want the websocket to be closed cleanly so that the server program keeps running and accepts a new connection. Right now, I have client side code as…
sawa
  • 165,429
  • 45
  • 277
  • 381
1
2 3 4