Questions tagged [em-websocket]

EventMachine based WebSocket server

EventMachine based, async, Ruby WebSocket server.

Link to Github

52 questions
1
vote
1 answer

em-websocket and javascript client connection

I've got a simple eventmachine web socket server (eventmachine 1.0.0): EM.run { # WebSocket Server EM::WebSocket.start(:host => "0.0.0.0", :port => 8080) do |ws| ws.onopen do sid = @channel.subscribe{|msg| ws.send msg } puts "*…
tommasop
  • 18,495
  • 2
  • 40
  • 51
1
vote
1 answer

em-websocket - *** buffer overflow detected ***: ruby terminated

I try to use eventmachine + em-websocket + redis to build a notification server. It looks good after I finishing almost all code. But, when I started to test connections, something happened. Connection can't be over than 1015 (I have no idea why…
hellolucky
  • 111
  • 1
  • 8
1
vote
1 answer

Multiple subscribers with EM-WebSocket or Goliath

So I'm attempting to setup em-websocket (or potentially Goliath), so that users can come to a different route and thusly be subscribed to only that channel, so for example: example.com/channel_1 Browsers open there will only receive messages…
JP Silvashy
  • 46,977
  • 48
  • 149
  • 227
1
vote
2 answers

Websockets, em-websocket & HAProxy 502 error

I'm trying to run a webserver and websocket server on port 80. To do this I'm using HAProxy to route the connections using this config: global maxconn 4096 # Total Max Connections. This is dependent on ulimit nbproc 1 ulimit-n …
Mike Neumegen
  • 2,436
  • 1
  • 24
  • 39
1
vote
1 answer

Is it safe to store an eventmachine websocket connection on the class level?

I'm writing a chat server application where the users can exchange messages with one of his friends. When the user connects i store his connection on an class variable hash: @@connections[:user_id] = conn When someone sends the user a message, I…
marcosbeirigo
  • 11,098
  • 6
  • 39
  • 57
0
votes
1 answer

WebSockets: How to notify all subscribers when a client connection has dropped?

I have a little WebSocket chat demo that I am working on (based on this code). However, the part that doesn't seem to be working is when a connection is closed between a client and the server, I want to notify all the subscribers that the user has…
Andrew
  • 227,796
  • 193
  • 515
  • 708
0
votes
1 answer

Add em-websocket to my application with puma

I have a Ruby application running with Puma. Now I wanted to add a websocket to broadcast REST requests to the connected clients. I managed to create a websocket server with em-websocket gem just by adding some code in my config.ru: …
kinglite
  • 339
  • 3
  • 20
0
votes
0 answers

Supporting WebSockets on Phusion Passenger with em-websocket

I am trying to support a WebSocket interface to my Rails application. I am on Rails 4 with no plans of moving to Rails 5 immediately. I use Phusion Passenger 5.0.30 behind nginx. I want to use em-websocket (+eventmachine) to build this support. What…
CppNoob
  • 2,322
  • 1
  • 24
  • 35
0
votes
1 answer

Rails push EM-Socket

I'm writing rails app and i want user to receive notification as soon as new message is saved to DB. For websocket i'm using em-websocket gem. After connection, i store client id and socket instance in array. Question: How to push data to the…
Src
  • 5,252
  • 5
  • 28
  • 56
0
votes
0 answers

WebSocket server settings

I use em-websocket gem in Rails application. WebSocket server runs in the initializer, this is how it looks: #config/initializers/web_socket.rb EM.next_tick do EM::WebSocket.run(host: '0.0.0.0', port: 8080) do |ws| ws.onopen do |request| …
0
votes
1 answer

Detect if WebSocket connection is terminated on server side

I want to handle differently different cases of WebSocket connection termination. I should send email if it's terminated on client side by logout or browser closing. And I should do nothing if it's terminated on server side (for example after the…
Sergei Struk
  • 358
  • 4
  • 12
0
votes
1 answer

How do I associate an Activerecord Object with Em-Websocket connection?

I am new to ruby. I am trying to implement a chat client using em-websocket. I have the following code: EventMachine::WebSocket.start(host: '0.0.0.0', port: 8080) do |websock| websock.onopen do puts 'New Connection Opened' cookies…
AEonAX
  • 501
  • 12
  • 24
0
votes
1 answer

Seeing long delays due to EventMachine quantum – how can I speed things up?

I am developing a real-time application using EventMachine. Two clients, A and B, connect to an EventMachine server over standard TCP, or via WebSocket with em-websocket. Every time data goes through EventMachine, code execution takes a 95ms hit.…
Schrockwell
  • 838
  • 1
  • 8
  • 25
0
votes
2 answers

em-websocket send() send from one client to another through 2 servers

I have two websocket clients, and I want to exchange information between them. Let's say I have two instances of socket servers, and 1st is retrieve private information, filter it and send to the second one. require 'em-websocket' EM.run do …
Alex Antonov
  • 14,134
  • 7
  • 65
  • 142
0
votes
1 answer

WebSocket in initializers, doesn't start in detached mode

My webapp consits of a HTTP server and a WebSocket server, both running on Rails. For Websockets I am using em-websocket which I start in the initializers, like this: Thread.new do EventMachine.run do …
Gregor Weber
  • 690
  • 9
  • 24