Questions tagged [em-websocket]

EventMachine based WebSocket server

EventMachine based, async, Ruby WebSocket server.

Link to Github

52 questions
2
votes
1 answer

WebSocket handshake with Ruby and EM::WebSocket::Server

I am trying to create a simple WebSocket connection in JavaScript against my Rails app. I get the following: WebSocket connection to 'ws://localhost:4000/' failed: Error during WebSocket handshake: 'Sec-WebSocket-Accept' header is missing What am…
Chad Johnson
  • 21,215
  • 34
  • 109
  • 207
2
votes
0 answers

Setting up websockets server

this is my first time using websockets and I am having trouble getting my server to work. Below is the simple em-websocket server I copied from this github page. It's basically unchanged right now so it looks like so: require 'em-websocket' EM.run…
random
  • 125
  • 1
  • 7
1
vote
1 answer

EventMachine in Rails - where to put run loop?

I am trying to get an EventMachine server that runs when I run my rails server and not as a separate process. So for example, using the simple server example from here (em-websocket) you get the following (standalone?) ruby code: EventMachine.run…
Adam
  • 131
  • 9
1
vote
2 answers

Ruby: How to serve static HTML and an EventMachine WebSocket server from the same application?

I'm writing a simple chat application. The only "front-end" required is a single html file, a javascript file, and a few stylesheets. The majority of the application is the server-side EventMachine WebSocket server. I'm also trying to host this on…
Andrew
  • 227,796
  • 193
  • 515
  • 708
1
vote
0 answers

Websockets and Adafruit Feather OpCode 11

My goal is to connect an Adafruit Feather (WiFi) to a Websocket Server running on my computer. Server: EventMachine Simple Server Example Clients: ArduinoHttpClient > SimpleWebsocketExample My issues is that when I reset my Feather, I sometimes…
cearto
  • 23
  • 4
1
vote
1 answer

How do we speed up transmission between client and server using websockets?

Currently, I am using websockets to send an image to my server, process it, and then send it back. Specifically, I am using Ruby with Sinatra and sinatra-websocket. On my development server, it takes ~2 seconds to send an image to the server and…
Mark
  • 11
  • 2
1
vote
0 answers

WebSocket create issue

Am creating a WebSocket application which will connect with wss url (say wss://someurl). I got some sample code from here https://github.com/elabs/mobile-websocket-example which is simple chat app. This is working fine for ws protocol. But when I…
Perseus
  • 1,546
  • 4
  • 30
  • 55
1
vote
2 answers

The stratigy of build a talk-to-talk system using em-websocket in rails?

Maybe it is a good example for server push system. There are many users in the system, and users can talk with each other. It can be accomplished like this: one user sends message(through websocket) to the server, then the server forward the message…
Run
  • 876
  • 6
  • 21
1
vote
2 answers

Sending large file in websocket before timeout

I'm using Faye and EventMachine to open a socket to another server. The server times out if it doesn't detect activity. How do I send the file (binary encoded) so the server doesn't time out? Here's what I have: media_path =…
user3325749
  • 171
  • 1
  • 11
1
vote
0 answers

Ruby billboard with em-websocket

I try to build a billboard for displaying messages in a browser initiated by the server using sinatra. The obviest thing to do in the servercode was like this: server: require 'em-websocket' require 'yajl' require 'haml' require…
peter
  • 41,770
  • 5
  • 64
  • 108
1
vote
1 answer

Decrypt Rail 4 session cookie from websocket thread

Rails 4.1.8, ruby 2.1.5p273 I try to get session id from inside EventMachine::WebSocket thread. session and cookie objects are not avaible here, so it need to manually decrypt cookie from websocket handshake headers. Cookie is smth like…
1
vote
1 answer

Send messages on different channels using sinatra-websocket

Is there a way to send messages on different channels using the sinatra-websocket gem? Basically I'm trying to replace Pusher with sinatra-websocket. Here's what I'm doing with Pusher: Pusher["my_channel_A"].trigger('some_event_type',…
jesal
  • 7,852
  • 6
  • 50
  • 56
1
vote
2 answers

why can't I run em-websocket-server on JRuby?

I'm running JRuby-1.7.3 through rvm. I've successfully installed the em-websocket-server gem. I can verify it's in my current gemset by running $ gem list. My code is this: require 'rubygems' require 'em-websocket-server' class EchoServer <…
RedFred
  • 999
  • 9
  • 20
1
vote
0 answers

em-websocket with private channels

I need to create a web-socket server, I am planning to use em-websocket. I need to support private channels, that is I should be able to send message to one particular channel or subscriber. There are many good chat examples that are in broadcast…
roxxypoxxy
  • 2,973
  • 1
  • 21
  • 28
1
vote
2 answers

How do I talk to a client from within a loop using EventMachine?

I want to show my program's progress (exemplified here as a loop) on a website in real-time. If I have a proper Ruby server running, a client should be able to connect to the server via websockets using a browser, and, once connected, receive…
Pandem1c
  • 778
  • 1
  • 5
  • 12