WebSockets Hanami: 1.x

AnyCable

{ "title": "WebSockets", "frontmatter": { "title": "WebSockets", "lang": "en-US", "sources": [], "description": "/config/initializers/anycable.rb", "meta": [ { "name": "twitter:title", "content": "WebSockets" }, { "name": "twitter:description", "content": "/config/initializers/anycable.rb" }, { "name": "twitter:card", "content": "summary" }, { "name": "twitter:url", "content": "https://hanami-cookbook.stdout.in/pages/websockets.html" }, { "name": "twitter:site", "content": "@iJackUA" }, { "property": "og:type", "content": "article" }, { "property": "og:title", "content": "WebSockets" }, { "property": "og:description", "content": "/config/initializers/anycable.rb" }, { "property": "og:url", "content": "https://hanami-cookbook.stdout.in/pages/websockets.html" }, { "property": "og:site_name", "content": "Hanami Cookbook" }, { "itemprop": "name", "content": "WebSockets" }, { "itemprop": "description", "content": "/config/initializers/anycable.rb" } ] }, "regularPath": "/pages/websockets.html", "relativePath": "pages/websockets.md", "key": "v-2b6dfa9a", "path": "/pages/websockets.html", "headers": [ { "level": 2, "title": "AnyCable", "slug": "anycable" }, { "level": 2, "title": "LiteCable", "slug": "litecable" }, { "level": 2, "title": "AnyCable with Docker", "slug": "anycable-with-docker" } ], "lastUpdated": "7/11/2019, 1:55:45 PM" }

LiteCable

/config/initializers/anycable.rb

LiteCable.anycable!

AnyCable.connection_factory = Web::Sockets::Connection

Anycable.configure do |config|
  # put configs here, if needed
end

AnyCable.capture_exception do |ex|
  Hanami.logger.error "AnyCable error: #{ex.inspect}"
end

1
2
3
4
5
6
7
8
9
10
11
12

AnyCable with Docker