All Projects → palkan → Litecable

palkan / Litecable

Licence: mit
Lightweight Action Cable implementation (Rails-free)

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Litecable

EthernetWebServer
This is simple yet complete WebServer library for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21/SAMD51, nRF52, STM32, RP2040-based, etc. boards running Ethernet shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32. Coexisting now with `ESP32 WebServer` and…
Stars: ✭ 118 (-53.73%)
Mutual labels:  websockets
StarshipAcademy
a Multiplayer WebVR Space Shooter made with A-Frame and Socket.io
Stars: ✭ 24 (-90.59%)
Mutual labels:  websockets
tiny
Framework agnostic markup builder, useful for defining view helpers or as a micro templating dsl, plays nice with erb and haml
Stars: ✭ 13 (-94.9%)
Mutual labels:  sinatra
streamingDemo
No description or website provided.
Stars: ✭ 56 (-78.04%)
Mutual labels:  websockets
cloudflare-worker-graphql-ws-template
A template for WebSockets powered Cloudflare Worker project using graphql-ws
Stars: ✭ 21 (-91.76%)
Mutual labels:  websockets
WebCam-Streaming
Web-cam live streaming with websockets and SignalR with ASP.NET Core just for fun and to learn new things. 😀👨🏻‍💻
Stars: ✭ 31 (-87.84%)
Mutual labels:  websockets
react-admin-nest
React和Ant Design和 Nest.js 和 Mysql 构建的后台通用管理系统。持续更新。
Stars: ✭ 123 (-51.76%)
Mutual labels:  websockets
hoboken
Sinatra project generator and templates.
Stars: ✭ 82 (-67.84%)
Mutual labels:  sinatra
SadlyDistributed
Distributing your code(soul), in almost any language(state), among a cluster of idle browsers(voids)
Stars: ✭ 20 (-92.16%)
Mutual labels:  websockets
twiml template
TwiML templates for Rails and Tilt.
Stars: ✭ 16 (-93.73%)
Mutual labels:  sinatra
gemini-python
A python client for the Gemini API and Websocket
Stars: ✭ 71 (-72.16%)
Mutual labels:  websockets
LazWebsockets
Websocket Server and Client Library written in Lazarus
Stars: ✭ 51 (-80%)
Mutual labels:  websockets
onesait-cloud-platform-clientlibraries
Client libraries to interact with Onesait Platform Cloud Side (Digital Broker specially)
Stars: ✭ 15 (-94.12%)
Mutual labels:  websockets
reactive-streams-for-java-developers
No description or website provided.
Stars: ✭ 16 (-93.73%)
Mutual labels:  websockets
sudoku
Multiplayer concurrent sudoku. The winner is the player who fills the last cell correctly.
Stars: ✭ 15 (-94.12%)
Mutual labels:  websockets
cobra
Cobra is a realtime messaging server using Python3, WebSockets and Redis
Stars: ✭ 30 (-88.24%)
Mutual labels:  websockets
serverless-rack
Serverless plugin to deploy Ruby Rack applications (Sinatra/Rails/Padrino/Cuba etc.) and bundle gems
Stars: ✭ 58 (-77.25%)
Mutual labels:  sinatra
Helpdesk
Helpdesk web application built with Ruby, Sinatra, Bootstrap and jQuery
Stars: ✭ 14 (-94.51%)
Mutual labels:  sinatra
chat-with-deno-and-preact
Chat app with Deno + Preact
Stars: ✭ 27 (-89.41%)
Mutual labels:  websockets
echo-server
Echo Server is a container-ready, multi-scalable Node.js application used to host your own Socket.IO server for Laravel Broadcasting.
Stars: ✭ 36 (-85.88%)
Mutual labels:  websockets

Gem Version Build

Lite Cable

Lightweight ActionCable implementation.

Contains application logic (channels, streams, broadcasting) and also (optional) Rack hijack based server (suitable only for development and test due to its simplicity).

Compatible with AnyCable (for production usage).

Sponsored by Evil Martians

Examples

Installation

Add this line to your application's Gemfile:

gem "litecable"

And run bundle install.

Usage

Please, checkout Action Cable guides for general information. Lite Cable aims to be compatible with Action Cable as much as possible without the loss of simplicity and lightness.

You can use Action Cable javascript client without any change (precompiled version can be found here).

Here are the differences:

  • Use LiteCable::Connection::Base as a base class for your connection (instead of ActionCable::Connection::Base)

  • Use LiteCable::Channel::Base as a base class for your channels (instead of ActionCable::Channel::Base)

  • Use LiteCable.broadcast to broadcast messages (instead of ActionCable.server.broadcast)

  • Explicitly specify channels names:

class MyChannel < LiteCable::Channel::Base
  # Use this id in your client to create subscriptions
  identifier :chat
end
App.cable.subscriptions.create('chat', ...)

Using built-in server (middleware)

Lite Cable comes with a simple Rack middleware for development/testing usage. To use Lite Cable server:

  • Add gem "websocket" to your Gemfile

  • Add require "lite_cable/server"

  • Add LiteCable::Server::Middleware to your Rack stack, for example:

Rack::Builder.new do
  map "/cable" do
    # You have to specify your app's connection class
    use LiteCable::Server::Middleware, connection_class: App::Connection
    run proc { |_| [200, {"Content-Type" => "text/plain"}, ["OK"]] }
  end
end

Using with AnyCable

Lite Cable is AnyCable-compatible out-of-the-box:

  • Set broadcast adapter to AnyCable:
LiteCable.broadcast_adapter = :any_cable

You can also do this via configuration, e.g., env var (LITECABLE_BROADCAST_ADAPTER=any_cable) or broadcast_adapter: any_cable in a YAML config.

  • Configure connection factory:
AnyCable.connection_factory = MyApp::Connection

Then run AnyCable along with the app:

bundle exec anycable

# add -r option to load the app if it's not ./config/anycable.rb or ./config/environment.rb
bundle exec anycable -r ./my_app.rb

See Sinatra example for more.

Configuration

Lite Cable uses anyway_config for configuration.

See config for available options.

Unsupported features

  • Channel callbacks (after_subscribe, etc)

  • Stream callbacks (stream_from "xyz" { |msg| ... })

  • Periodical timers

  • Remote connections.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/palkan/litecable.

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].