Coder Social home page Coder Social logo

passenger-ruby-websocket-demo's Introduction

WebSockets on Phusion Passenger

This application demonstrates WebSocket support in Phusion Passenger. Passenger supports all major modern web technologies, such as WebSockets, entirely out of the box. You don't have to do anything: WebSocket support just works.

If you like this demo, please tweet about it or follow us on Twitter.

More information about Passenger:

Getting started

Clone this repository, install the gem bundle and start Passenger Standalone.

git clone https://github.com/phusion/passenger-ruby-websocket-demo.git
cd passenger-ruby-websocket-demo
bundle install
bundle exec passenger start

Access the demo application at http://0.0.0.0:3000/ and see it in action.

If you deploy this demo to production, be sure to enable sticky sessions in Passenger.

Compatibility

  • This app uses plain Rack, and thus is framework agnostic.
  • WebSockets work on Passenger for Nginx and Passenger Standalone. Apache is currently not supported.
  • At least version 5.0.25 of Passenger is required.
  • Only the RFC 6455 version of the WebSocket protocol is supported.

Tuning Passenger for WebSockets

WebSockets work great on both the open source variant of Phusion Passenger, as well as on Phusion Passenger Enterprise. But you need to tune a few settings. Please refer to the following places in the Passenger Library for more information:

This demo already contains tuning parameters for Passenger Standalone inside Passengerfile.json.

Next steps

Please enjoy Phusion Passenger, a product by Phusion. :-)

passenger-ruby-websocket-demo's People

Contributors

foobarwidget avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

passenger-ruby-websocket-demo's Issues

WebSocket connection failed

When I try to test this demo app on an Apache/Passenger based server, I get this message...

WebSocket connection to 'ws://www.flyonlinetools.help/websocket' failed: One or more reserved bits are on: reserved1 = 0, reserved2 = 1, reserved3 = 1

I think this is related to a WebSocket issue that I am having with another deployed app. Any help is greatly appreciated!

UPDATE: This error happens when I run under Apache/mod_passenger 4.0.46.
When I run the demo application in a standalone using bundle exec passenger start, the demo works perfectly.

UPDATE: Upgraded Passenger to 5.0.18, error is now failed: Error during WebSocket handshake: 'Connection' header is missing

Thanks for any help that you could provide! This is my first time with WebSockets, so I am struggling to debug.

EventMachine based websocket implementations

Hello!

Thanks for this example.

One question, some of the more popular websocket libraries like Firehose and Faye use EventMachine to handle the websocket requests. Is it possible to use one of these EventMachine based websocket libraries with Passenger?

For example Firehose is basically just a Rack app that wraps EventMachine.

https://github.com/polleverywhere/firehose/blob/master/lib/firehose/server/app.rb#L47

Does this mean one could mount that rack app within their Rails app and it would work with Passenger? Or would you have to have Nginx point Passenger to that Rack app and have it run as a separate process?

Any tips for how Passenger and EventMachine play together and fit into one of these scenarios?

Cheers

Can this work with Passenger 4.0.60?

As we are trying to enable Websockets on AWS ElasticBeanstalk, it only provides Passenger 4.0.60 option currently.

Does Passenger 4.0.60 support Websockets/Actioncable?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.