Giter Site home page Giter Site logo

anycable / anycable Goto Github PK

View Code? Open in Web Editor NEW
1.9K 32.0 92.0 5.69 MB

AnyCable for Ruby applications

Home Page: https://anycable.io

License: MIT License

Ruby 94.00% Shell 0.04% Makefile 0.56% Python 1.90% JavaScript 3.50%
websockets grpc actioncable ruby anycable hacktoberfest

anycable's Introduction

Gem Version Build Coverage Status Documentation

AnyCable

AnyCable allows you to use any WebSocket server (written in any language) as a replacement for your Ruby server (such as Faye, Action Cable, etc).

AnyCable uses the same protocol as ActionCable, so you can use its JavaScript client without any monkey-patching.

AnyCable Pro has been launched 🚀

Sponsored by Evil Martians

Requirements

Usage

Check out our 📑 Documentation.

Links

Talks

Building

Generating gRPC files from .proto

  • Install required GRPC gems:
gem install grpc
gem install grpc-tools
  • Re-generate GRPC files (if necessary):
make

Contributing

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

Please, provide reproduction script (using this template) when submitting bugs if possible.

License

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

Security Contact

To report a security vulnerability, please contact us at [email protected]. We will coordinate the fix and disclosure.

anycable's People

Contributors

accessd avatar alvir avatar avsej avatar bibendi avatar darthsim avatar depfu[bot] avatar earlopain avatar envek avatar iurev avatar jjb avatar jkeam avatar mabras avatar nepalez avatar nicolasleger avatar palkan avatar sadovnik avatar smasry avatar sponomarev avatar ur5us avatar vasfed avatar yenshirak 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  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  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

anycable's Issues

Streams are not streaming

I'm trying to migrate from action cable and faced with the next issues.

  1. Earlier I had this in ApplicationCable::Connection:
identified_by :current_user
    attr_accessor :current_admin, :current_account

    def connect
      self.current_user = find_verified_user
      self.current_account = current_user.account
      self.current_admin = admin
    end

and ApplicationCable::Channel included this line:

delegate :current_account,  to: :connection

After migration to anycable current_account has become nil (though it is still defined in Connection class).

  1. The second issue I noticed relates to my streams (I guess). I will try to describe it next:
    I have MeasurementChannel class and there:
def subscribed
    if params['measurement_id']
      stream = stream_name(user: current_user, object_id: measurement.id)
      stream_from stream
      account_stream = stream_name(account: current_account, object_id: measurement.id)
      stream_from account_stream
    else
      stream = stream_name(user: current_user)
      stream_from stream
    end
  end

stream_name is just helper method to provide proper stream name (as you can guess :)). For example: user/174/measurements/2992. Then in my business logic I dispatch data in the same channel ( user/174/measurements/2992) but it is not coming to my consumer.

support ruby 2.4

hi, the newist version of grpc has been released, can you upgrade anycable gem to support ruby 2.4? thanks.

Segmentation fault in Alpine

Hi, we're trying to Dockerize our Rails application which is using anycable to broadcast status updates, unfortunately when I try to start our DelayedJob, it's failed with this error:

job_1  | /usr/local/bundle/gems/anycable-0.5.1/lib/anycable/rpc/rpc_pb.rb:49: [BUG] Segmentation fault at 0x0000000000016d96
job_1  | ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux-musl]
job_1  |
job_1  | -- Control frame information -----------------------------------------------
job_1  | c:0066 p:---- s:0322 e:000321 CFUNC  :msgclass
job_1  | c:0065 p:0026 s:0318 e:000317 CLASS  /usr/local/bundle/gems/anycable-0.5.1/lib/anycable/rpc/rpc_pb.rb:49
job_1  | c:0064 p:0039 s:0315 E:001880 TOP    /usr/local/bundle/gems/anycable-0.5.1/lib/anycable/rpc/rpc_pb.rb:48 [FINISH]
job_1  | c:0063 p:---- s:0312 e:000311 CFUNC  :require
job_1  | c:0062 p:0012 s:0307 e:000306 BLOCK  /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293
job_1  | c:0061 p:0057 s:0304 e:000303 METHOD /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259
job_1  | c:0060 p:0017 s:0298 e:000297 METHOD /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293
job_1  | c:0059 p:0017 s:0292 e:000291 TOP    /usr/local/bundle/gems/anycable-0.5.1/lib/anycable/rpc_handler.rb:4 [FINISH]
job_1  | c:0058 p:---- s:0289 e:000288 CFUNC  :require
job_1  | c:0057 p:0012 s:0284 e:000283 BLOCK  /usr/local/bundle/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293
... the log is very long so it's hidden for now

Not sure if this helps. We're using alpine Docker image and we have to install libc6-compat as mentioned in grpc/grpc#6126 for the same error happened to the grpc ruby library.

Any help is appreciated, thanks in advance.

AWS ECS - cannot connect to GRPC server

Ruby version: 2.6.6

**anycable gem version:1.0.1

**grpc gem version:1.30.0

What did you do?

I tried to deploy my app in AWS ECS. One container runs RoR app with GRPC server, the other container runs anycable-go server. This setup when run locally with docker-compose works fantastic. It is a challenge to make it work on AWS ECS though.

What did you expect to happen?

To run as smoothly as with docker-compose on my local environment.

What actually happened?

Anycable-go container cannot connect to GRPC server (running together with my ruby API). The log shows error:
E 2020-07-27T17:57:02.530Z context=ws Websocket session initialization failed: rpc error: code = Unavailable desc = last connection error: connection error: desc = "transport: Error while dialing dial tcp: lookup API on 10.0.0.2:53: no such host"

I believe this is a network issue (probably ENVs are incorrect or I am missing some).

My ENVs for actioncable-go container:

ANYCABLE_HOST=0.0.0.0
ANYCABLE_RPC_HOST=API:50051 (where API is name for my API with GRPC server)
REDIS_URL=my redis endpoint (working for sure)

MY ENVs for api + gcpr container:

REDIS_URL=my redis endpoint (working for sure)
ANYCABLE_RPC_HOST=0.0.0.0:50051
CABLE_URL=ws://localhost:8080/cable
RAILS_ENV=production

I really appreciate any help cause I'm stucked. Thank you for you great work!

RPC Connect nil

Tell us about your environment

Ruby version: 2.7.1

anycable gem version: 1.0.1

grpc gem version: 1.30.1

What did you do?

Added exception handler for anycable grpc instances according to doc https://docs.anycable.io/#/v1/ruby/exceptions. I guess this is not the culprit here but I just got aware after checking the logs and still seeing that no sentry errors are appearing.

What did you expect to happen?

Sentry errors appearing and RPC connections being properly established.

What actually happened?

D, [2020-07-21T22:48:59.561456 #8] DEBUG -- : [AnyCable sid=_aJk9rA79LnZuEfP-1GmV] RPC Connect: nil
I, [2020-07-21T22:48:59.568989 #8]  INFO -- : [AnyCable sid=_aJk9rA79LnZuEfP-1GmV] Sending event e152428270da4a4b8f79a20903fce2a7 to Sentry
E, [2020-07-21T22:48:59.707319 #8] ERROR -- : [AnyCable sid=_aJk9rA79LnZuEfP-1GmV] undefined method `env' for nil:NilClass

This does not happen for all gRPC connections. There are various problems in the go websocket part according to our logs as well:

D 2020-07-21T22:41:50.155Z context=ws Websocket connection upgrade error: "websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header"
D 2020-07-21T21:33:37.289Z context=node sid=khA1x6VyRAhgllT8xScZa Websocket close error: websocket: close 1006 (abnormal closure): unexpected EOF

I guess the first can be neglected as it could be some misbehaviour of some client or our proxy/load-balancer. Any suggestions I can help to debug this further? I assume Sentry Raven internally relies on a env method (maybe Rails.env?), but without a stacktrace which I currently don't know how to get its quite hard to tell.

I've set LOG_LEVEL to debug on the grpc instances and ANYCABLE_DEBUG to true on websocket instances.

bundle exec anycable command is not doing anything

Ruby version: 2.7.1

anycable gem version: 1.0.0

grpc gem version: 1.28

It works great in development environment,
but the command RAILS_ENV=production bundle exec anycable
is not doing anything in ubuntu server. It's just printing this:

$ RAILS_ENV=production bundle exec anycable
/shared/bundle/ruby/2.7.0/gems/anyway_config-2.0.5/lib/.rbnext/2.8/anyway/tracing.rb:176: warning: Passing the keyword argument as the last hash parameter is deprecated
/shared/bundle/ruby/2.7.0/gems/anyway_config-2.0.5/lib/.rbnext/2.8/anyway/tracing.rb:35: warning: The called method `record_value' is defined here

even using debug modes.

I don't know if that's the reason but the wss url is not working.

action_cable.js:241 WebSocket connection to 'wss://stage.xxxxxx.io:3334/cable' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

rpc systemd service

[Unit]

Description=anycable for staging
After=syslog.target network.target

[Service]

Type=simple
WorkingDirectory=/home/deploy/stage.xxxxxxx.io/current

ExecStart=/bin/bash -lc 'bundle exec anycable'
ExecStop=/bin/kill -TERM $MAINPID

User=deploy
Group=deploy
UMask=0002

MemoryHigh=2G
MemoryMax=3G
MemoryAccounting=true

RestartSec=1
Restart=on-failure

Environment=RAILS_ENV=production
Environment=ANYCABLE_PORT=3334
Environment=ANYCABLE_REDIS_URL='xxxxxxx'
Environment=ANYCABLE_HOST=stage.xxxxxxx.io
Environment=ANYCABLE_PATH=/cable
Environment=ANYCABLE_REDIS_CHANNEL=__anycable__

[Install]

WantedBy=multi-user.target

anycable GO service

[Unit]
Description=AnyCable Go WebSocket Server
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/anycable-go -headers=cookie,x-api-token,origin --ssl_cert=/etc/letsencrypt/live/stage.xxxxxxxx.io/fullchain.pem --ssl_key=/etc/letsencrypt/live/stage.xxxxxxxxxx.io/privkey.pem
ExecStop=/bin/kill -TERM $MAINPID

LimitNOFILE=16384 # increase open files limit (see OS Tuning guide)

Restart=on-failure

# Configure WebSocket server using env vars
Environment=RAILS_ENV=production
Environment=ANYCABLE_PORT=3334
Environment=ANYCABLE_REDIS_URL='xxxxxxxxxxxx'
Environment=ANYCABLE_HOST=stage.xxxxxxxxxx.io
Environment=ANYCABLE_PATH=/cable
Environment=ANYCABLE_REDIS_CHANNEL=__anycable__
# Environment=ANYCABLE_RPC_HOST=localhost:50051
# Environment=ANYCABLE_METRICS_HTTP=/metrics

[Install]
WantedBy=multi-user.target

services log

● anycable-go.service - AnyCable Go WebSocket Server
   Loaded: loaded (/etc/systemd/system/anycable-go.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-07-01 21:52:40 UTC; 3min 9s ago
  Process: 7974 ExecStop=/bin/kill -TERM $MAINPID (code=exited, status=0/SUCCESS)
 Main PID: 7976 (anycable-go)
    Tasks: 8 (limit: 4915)
   CGroup: /system.slice/anycable-go.service
           └─7976 /usr/local/bin/anycable-go -headers=cookie,x-api-token,origin --ssl_cert=/etc/letsencrypt/live/stage.xxxxxxxxxx.io/fullchain.pem --ssl_key=/etc/letsencrypt/live/stage.xxxxxxx.io/privk

Jul 01 21:52:40 stage systemd[1]: Started AnyCable Go WebSocket Server.
Jul 01 21:52:40 stage anycable-go[7976]: I 2020-07-01T21:52:40.189Z context=main Starting AnyCable 1.0.0-33085f2 (pid: 7976, open file limit: 1024)
Jul 01 21:52:40 stage anycable-go[7976]: I 2020-07-01T21:52:40.190Z context=main Handle WebSocket connections at https://stage.xxxxxxxxxx.io:3334/cable
Jul 01 21:52:40 stage anycable-go[7976]: I 2020-07-01T21:52:40.190Z context=main Handle health connections at https://stage.xxxxxxxxx.io:3334/health
Jul 01 21:52:40 stage anycable-go[7976]: I 2020-07-01T21:52:40.191Z context=rpc RPC controller initialized: localhost:50051 (concurrency: 28, proto_versions: v0,v1)
Jul 01 21:52:40 stage anycable-go[7976]: I 2020-07-01T21:52:40.291Z context=pubsub Subscribed to Redis channel: __anycable__

● anycable.service - anycable for staging
   Loaded: loaded (/etc/systemd/system/anycable.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-07-01 21:52:40 UTC; 3min 9s ago
  Process: 7975 ExecStop=/bin/kill -TERM $MAINPID (code=exited, status=0/SUCCESS)
 Main PID: 7995 (bundle)
    Tasks: 40 (limit: 4915)
   Memory: 114.6M (high: 2.0G max: 3.0G)
   CGroup: /system.slice/anycable.service
           └─7995 /var/www/stage.xxxxxxxxxx.io/shared/bundle/ruby/2.7.0/bin/anycable

Jul 01 21:52:40 stage systemd[1]: Stopped anycable for staging.
Jul 01 21:52:40 stage systemd[1]: Started anycable for staging.
Jul 01 21:52:41 stage bash[7995]: /var/www/stage.xxxxxxxxxxx.io/shared/bundle/ruby/2.7.0/gems/anyway_config-2.0.5/lib/.rbnext/2.8/anyway/tracing.rb:176: warning: Passing the keyword argument as the last ha
Jul 01 21:52:41 stage bash[7995]: /var/www/stage.xxxxxxxxxx.io/shared/bundle/ruby/2.7.0/gems/anyway_config-2.0.5/lib/.rbnext/2.8/anyway/tracing.rb:35: warning: The called method `record_value' is defined

environments/production.rb

  5   config.after_initialize do
  6     config.action_cable.url = ActionCable.server.config.url = 'wss://stage.xxxxxx.io:3334/cable'
  7     config.action_cable.allowed_request_origins = [
  8       "https://#{Current.domain}",
  9       "https://www.#{Current.domain}"
 10     ]
 11   end

Thanks in advance

Receiving cryptic error when actioncable pings server

For some reason, I get ActionController::RoutingError (No route matches [GET] "/("):. Am I running the server incorrectly?

Use Ctrl-C to stop
Started GET "/(?-mix:ws:\/\/*)%20(?-mix:wss:\/\/*)" for 127.0.0.1 at 2018-10-29 23:44:29 -0400
   (0.0ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC

Redis dependency causing loading error

Tell us about your environment

Ruby version: 2.4.2

anycable gem version: 0.6.2

grpc gem version: 1.19.0

What did you do?

I'm trying to broadcast a message from one rails app (with custom loaders so that it only work as a backend server) to another rails app.

What did you expect to happen?

Expecting it to broadcast message without any error

What actually happened?

There's an error while broadcasting to another rails app. The error I received was Gem::LoadError: Error loading the 'redis' broadcast adapter for AnyCable, which I took some while to trace it back to anycable gem instead of anycable-rails. This is the error message I get: #<Gem::LoadError: can't activate redis (>= 4.0), already activated redis-3.3.5. Make sure all dependencies are added to Gemfile.>

I saw this line on top of the file in lib/anycable/broadcast_adapters/redis.rb

gem "redis", ">= 4.0"

This raised error because the redis version installed in the rails app is 3.3.5. Maybe upgrading the gem version could work but we don't want to put anything else at risk. Is it possible to better manage the gem, at least putting it as part of the dependency, best if redis version 3.3.5 is supported? We're using anycable in out receiving end also, maybe an older version of anycable gems, but it works without this hassle.

Soft exit

Hey,

One more time thanks for creating this amazing product.

I have a question about exiting RPC server and maybe anycable-go server.

The problem is about my callback def unsubscribe for specific channels.
When I terminate the process of the RPC server (./bin/anycable), I get something like this:

^C/Users/kristis/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/grpc-1.8.0-universal-darwin/src/ruby/lib/grpc/generic/rpc_server.rb:391:in `request_call': Interrupt
	from /Users/kristis/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/grpc-1.8.0-universal-darwin/src/ruby/lib/grpc/generic/rpc_server.rb:391:in `loop_handle_server_calls'
	from /Users/kristis/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/grpc-1.8.0-universal-darwin/src/ruby/lib/grpc/generic/rpc_server.rb:352:in `run'
	from /Users/kristis/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/anycable-0.5.0/lib/anycable/server.rb:17:in `start'
	from ./bin/anycable:8:in `<main>'
E1223 22:23:43.886264000 140737055724480 completion_queue.cc:510]      assertion failed: cqd->completed_head.next == (uintptr_t)&cqd->completed_head
Abort trap: 6

I'd like to have something like soft exit, where the unsubscribe callbacks could be called before actual process exits. So for each existing subscription for a particular server, there should be connection terminating hook.

It this feature present and I can't see it? Maybe you see this as a nice feature to have?

Thanks

Connections tracking

Hello everyone,

First of all, the product which you are creating looks amazing.

I'm working on a quite sophisticated solution when it comes to websockets. My current feature needs to track users as online/offline. For that I use ActionCable appearance channel where I have def subscribed and def unsubscribed and respectively flag an user online or offline.

The problem appears with multiple browser tabs or windows. With this you get multiple subscriptions and if you close one, you don't need to flag the user as offline.

To avoid these conflicts I need to know what are current subscriptions/connections present at that point.
With ActionCable (and without AnyCable) you can do ActionCable.server.connections which is returning accumulated connections and you still can't trust it but still it returns at least something. With AnyCable the result is always an empty array.

My question would be, is there any chance I could get the global subscriptions/connections data from anywhere in your product?

Windows 10 Compatibility?

I tried to use rails g anycable:install and ./bin/anycable commands. But, they don't seem to be available. I'm currently running Rails 5.2.0 & Ruby 2.4.4 x64. The gem anycable itself is version 0.5.5

RAILS_ENV=production bundle exec anycable not doing anything

Tell us about your environment

Hi guys, I can't get anycable running on my production server. I'm using linode Ubuntu 20.04 instance if that helps.
The weird thing is RAILS_ENV=production bundle exec anycable -v prints out the anycable version but RAILS_ENV=production bundle exec anycable is not doing anything.

Ruby version:
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]

anycable gem version:
v1.0.1

grpc gem version:
v1.32.0

What did you do?

RAILS_ENV=production bundle exec anycable

What did you expect to happen?

It should show that AnyCable gRPC server is running
This works on my local ubuntu 20.04 laptop.

Starting AnyCable gRPC server (pid: 77626, workers_num: 30)
AnyCable version: 1.0.1 (proto_version: v1)
gRPC version: 1.32.0
Serving Rails application from ./config/environment.rb
Broadcasting Redis channel: __anycable__
RPC server is starting...
RPC server is listening on 127.0.0.1:50051

What actually happened?

Nothing. Nothing was print out from my console.
image

Improve logging and exceptions handling

  • Default logger should always log to STDOUT with info level by default

  • Debug mode (ANYCABLE_DEBUG) should turn log level to debug and set GRPC.logger to Anycable.logger (otherwise do not override GRPC logger)

  • Provide an ability to capture exceptions (e.g. to notify 3rd-party services, like Sentry, etc) (see anycable/anycable-rails#14)

Running bundle exec anycable as background process

I've moved to anycable after experiencing some issues with actioncable, and it works quite well.

The only remaining issue is the running of 'bundle exec anycable' in the background, any ideas on how to achieve this? btw - anycable-go works fine with nohup

thanks

Auth failed with devise_token_auth

Hey there!
I can't establish a connection when using the authentication gem devise_token_auth.
I try to identify the user like this:

`
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
identified_by :device

def connect
  self.current_user = find_verified_user
  self.device = Device.find(request.params[:device_id])
end

def disconnect
end

def find_verified_user
  logger.error request.params.inspect
  user = request.params[:uid].present? && User.find_by_uid(request.params[:uid])
  if user && user.valid_token?(request.params[:"access-token"], request.params[:client])
    logger.error "Success"
    return user
  else
    user = nil
    reject_unauthorized_connection
  end
end

end
end

`

and anycable-go gives me "Auth failed".

Params are getting through, the device is getting loaded but it never stays connected. When I change
self.current_user = find_verified_user to self.current_user = User.find(request.params[:user_id])
it keeps the connection alive.

When logging the params connection.rb gets, it seems like anycable is somehow stalling or something the requests: http://pastebin.com/w6NtPd5U

Sinatra/Non-rails

Can this be used with Sinatra or any non-rails frameworks?

thanks

Websocket disconnects while sending uint8Array data.

Tell us about your environment

Ruby version:
2.6.6
anycable gem version:
0.6.5
grpc gem version:
1.17

What did you do?

Tried to send a uint8array from client to server.

What did you expect to happen?

The server should have received and stored the sent data.

What actually happened?

The upload stops mid way through and the websocket connection resets itself (disconnects and reconnects automatically).

I'm trying to send binary (uint8Array) data over a websocket from browser to server...
The websocket connection will disconnect and reconnect automatically without any error after sending the binary data and then terminating the upload before it finishes.
My theory is that the ping message received from the server every 3 seconds is interrupted by the data upload so the client tries to reset the connection when it doesn't receive the ping message on time.
Is this accurate or could it be something to do with the size being too large or something else?

Here is a server log from Rails.
Line 19 is where the disconnect happens while receiving the data.
https://pastebin.com/80k3vT5W
edit:
https://github.com/anycable/anycable/files/4908585/anycablelog.txt

Add access logging

Similar to ActionCable #started_request_message and #finished_request_message:

Started GET "/cable/" [WebSocket] for 127.0.0.1 at 2017-08-14 12:42:50 +0300

but:

Started GET "/cable/" [AnyCable] for 127.0.0.1 at 2017-08-14 12:42:50 +0300

That would require adding REMOTE_IP header.

Also, that should be configurable (i.e. AnyCable.config.access_logs_disabled = true to turn it off).

Client does not receive message through channel he just subscribed to.

Ruby version: 2.6.3

anycable gem version: 0.6.3
anycable-rails gem version: 0.6.4

grpc gem version: 1.24.0

What did you do?

In subscribed method of my channel I assign stream for connection and immediately broadcast a message to that stream.

Channel:

class TestChannel < ApplicationCable::Channel
  def subscribed
    stream_from 'test_room'
    ActionCable.server.broadcast('test_room', 'Hello world!')
  end
end

Frontend subscription:

App.cable.subscriptions.create({
  channel: 'TestChannel'
}, {
  received (data) {
    alert(data);
  }
});

What did you expect to happen?

Subscribed browser tab will immediately receive a 'Hello world!' message.
It worked like that with ActionCable

What actually happened?

Subscribed browser tab does not receive any messages (not until another tab subscribes, but that is expected).

Auth Failed - 743: unexpected token at ''

Добрый день
Подскажите, получаю ошибку
anycable rpc :

deadline is 1970-01-01 02:59:59 +0300; (now=2017-07-18 13:36:59 +0300)
schedule another job
RPC Connect: #<Anycable::ConnectionRequest:0x007f2b8cb91a18>
743: unexpected token at ''

и
anycable-go :

Auth 
Auth Failed

сразу после подключения любым из нижеперечисленных способов

node
ws = new WebSocket('ws://domain:8080/cable');
JS
socket = new WebSocket('ws://domain:8080/cable');
swift
let socket = WebSocket(url: URL(string: "ws://domain:8080/cable")!, protocols: ["actioncable-v1-json", "actioncable-unsupported"])

объясните пожалуйста в чем суть проблемы, что я пропускаю ?

Unable to add defs to DescriptorPool

Ruby 2.4.0p0
Latest gem version
Latest anycable-go binary

Attempting to use it for the first time and when running the rails g anycable command, I get this error:

/home/vagrant/.rvm/gems/ruby-2.4.0@global/gems/bundler-1.13.7/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'anycable'. (Bundler::GemRequireError)
Gem Load Error is: Unable to add defs to DescriptorPool: Symtab already has a def named 'anycable.ConnectionRequest_MapEntry_headers'

Use interceptors

GRPC interceptors suppors has been added in 1.7.0.

  • Re-write exceptions handling using interceptors

  • Add Anycable interceptors API to register custom interceptors (e.g. ActiveRecord connections handling in anycable-rails); this API should allow to dynamically add interceptors before server start and raise exceptions when an attempt to add interceptor after start has been made.

Ruby 3.0.0 tried to create Proc object without a block (ArgumentError)

Tell us about your environment

Ruby version: 3.0.0

anycable gem version: anycable (1.0.2)

grpc gem version: grpc (1.36.0)

What did you do?

Upgrade ruby version from 2.7.2 to 3.0.0

What did you expect to happen?

Everything work as before :)

What actually happened?

Anycable failed with error: tried to create Proc object without a block

Backtrace:

{"host":"backend-6674b567f7-5cwqj","application":"Semantic Logger","environment":"production","timestamp":"2021-03-05T09:40:07.738947Z","level":"info","level_index":2,"pid":6,"thread":"6100","name":"ActionCable","message":"ruby 3.0.0 (2020-12-25) [x86_64-linux]","dd":{}}
tried to create Proc object without a block
/app/vendor/ruby/3.0.0/gems/anycable-1.0.2/lib/anycable/cli.rb:108:in `new'
/app/vendor/ruby/3.0.0/gems/anycable-1.0.2/lib/anycable/cli.rb:108:in `at_stop'
/app/vendor/ruby/3.0.0/gems/anycable-1.0.2/lib/anycable/cli.rb:189:in `start_health_server!'
/app/vendor/ruby/3.0.0/gems/anycable-1.0.2/lib/anycable/cli.rb:67:in `run'
/app/vendor/ruby/3.0.0/gems/anycable-1.0.2/bin/anycable:7:in `<top (required)>'
/app/vendor/ruby/3.0.0/bin/anycable:23:in `load'
/app/vendor/ruby/3.0.0/bin/anycable:23:in `<top (required)>'
/usr/local/bundle/gems/bundler-2.2.8/lib/bundler/cli/exec.rb:63:in `load'
...

Mounting on path other than /cable

Hi, thank you for building this great library.
We are currently giving Anycable a try and are thinking about putting it in production.

In order to make the transition from Actioncable to Anycable smooth for the connected users we need to keep a similar connection url.
I don't seem any mention in your documentation of a way to change the mounting path from /cable to another path, or in our case just /.

Is there an easy way to do this ?

Thanks

Incompatible AnyCable RPC client

When try to start the server: bundle exec anycable --server-command "anycable-go --host=localhost --port=3334" it returns this error:status:13:Incompatible AnyCable RPC client. and the method connect in connection.rb is not even called. I'm using 1.0.0.rc2 version.

Exception while handling disconnection of connection with multiple channels

I have a problem when handling disconnection (closed browser tab) from connection with three channels being connected to.

As it can be seen from logs, anycable-go server sends disconnection request for three channels with ids 165d8949069, 165d8941e62, 165d8942db1:

map[{"channel":"GraphqlChannel","channelId":"165d8949069"}:true {"channel":"GraphqlChannel","channelId":"165d8941e62"}:true {"channel":"GraphqlChannel","channelId":"165d8942db1"}:true]

but RPC server receives only data for one of them (165d8942db1) and empty strings for others:

subscriptions: ["{\"channel\":\"GraphqlChannel\",\"channelId\":\"165d8942db1\"}", "", ""]

which causes ActionCable internals to fail here with exception An empty string is not a valid JSON string.:

https://github.com/rails/rails/blob/375a4143cf5caeb6159b338be824903edfd62836/actioncable/lib/action_cable/connection/subscriptions.rb#L27-L29

I've compared protobuf declarations for anycable-go and anycable gem and they seem to match: both declare subscriptions as repeatable string.

Have no idea about where these empty strings are coming from.

Logs:

anycable  |  DEBUG 2018-09-14T14:54:47.805Z context=node sid=zkAaDO9AVIE4Z05TK8vt8u websocket session completed
anycable  |  DEBUG 2018-09-14T14:54:47.805Z channel={"channel":"GraphqlChannel","channelId":"165d8949069"} context=hub sid=zkAaDO9AVIE4Z05TK8vt8u Unsubscribed             
anycable  |  DEBUG 2018-09-14T14:54:47.805Z channel={"channel":"GraphqlChannel","channelId":"165d8941e62"} context=hub sid=zkAaDO9AVIE4Z05TK8vt8u Unsubscribed             
anycable  |  DEBUG 2018-09-14T14:54:47.805Z channel={"channel":"GraphqlChannel","channelId":"165d8942db1"} context=hub sid=zkAaDO9AVIE4Z05TK8vt8u Unsubscribed             
anycable  |  DEBUG 2018-09-14T14:54:47.805Z context=hub sid=zkAaDO9AVIE4Z05TK8vt8u Unregistered             
anycable  |  DEBUG 2018-09-14T14:54:47.805Z context=node sid=zkAaDO9AVIE4Z05TK8vt8u Disconnect {"account":"Z2lkOi8vZWJheS1tYWcyL0FjY291bnQvMQ"} /cable?token=jwt map[cookie:cookie] map[{"channel":"GraphqlChannel","channelId":"165d8949069"}:true {"channel":"GraphqlChannel","channelId":"165d8941e62"}:true {"channel":"GraphqlChannel","channelId":"165d8942db1"}:true]
rpc       | RPC Disconnect: <Anycable::DisconnectRequest: identifiers: "{\"account\":\"Z2lkOi8vZWJheS1tYWcyL0FjY291bnQvMQ\"}", subscriptions: ["{\"channel\":\"GraphqlChannel\",\"channelId\":\"165d8942db1\"}", "", ""], path: "/cable?token=jwt", headers: {"cookie"=>"cookie"}>
rpc       | An empty string is not a valid JSON string.
anycable  |  DEBUG 2018-09-14T14:54:47.810Z context=rpc Disconnect response: error_msg:"An empty string is not a valid JSON string." 
anycable  |  ERROR 2018-09-14T14:54:47.811Z context=node sid=zkAaDO9AVIE4Z05TK8vt8u Disconnect error: Application error: An empty string is not a valid JSON string.

Backtrace:

 0: /home/envek/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/json/decoding.rb:23:in `parse'
 1: /home/envek/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/json/decoding.rb:23:in `decode'
 2: /home/envek/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/actioncable-5.2.1/lib/action_cable/connection/subscriptions.rb:29:in `add'
 3: /home/envek/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/anycable-rails-0.5.4/lib/anycable/rails/refinements/subscriptions.rb:9:in `fetch'
 4: /home/envek/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/anycable-rails-0.5.4/lib/anycable/rails/actioncable/connection.rb:40:in `block in initialize'
 5: /home/envek/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/anycable-rails-0.5.4/lib/anycable/rails/actioncable/connection.rb:40:in `each'
 6: /home/envek/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/anycable-rails-0.5.4/lib/anycable/rails/actioncable/connection.rb:40:in `initialize'
 7: /home/envek/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/anycable-rails-0.5.4/lib/anycable/rails/actioncable/connection.rb:17:in `new'
 8: /home/envek/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/anycable-rails-0.5.4/lib/anycable/rails/actioncable/connection.rb:17:in `call'

anycable-go 0.6.0 built from master.
gem anycable 0.5.2
gem anycable-rails 0.5.4
Ruby on Rails 5.2.1
gem grpc 1.15.0-x86_64-linux
gem google-protobuf 3.6.1 from master at ff3891dab1b1

able to change default healthcheck path?

Hi, thanks for this amazing project!

I'm confused about the healthcheck server behavior. it seems like by default there is a healthcheck endpoint at /health on the same port as the websockets server.

when i try to change the path, it doesn't work. when i specify both a new path and port, then it creates another parallel server on that port, with that path.

is this the expected behavior?

is there a way to change the path on the default server? (pretty much a necessity in my deploy environment)

thanks!

image
image
image

Benchmarks for nodejs and other languages?

Hi,

This project seems really awesome!

For I while I was interested in ActionCable, but I knew that it would have pretty serious performance issues in production. So I haven't used it in a production site. I've worked on a production site that uses Faye for node (which is considerably faster than Faye for Ruby).

After seeing the benchmarks from the AnyCable blog post, I was very impressed by the performance gains you've made while sticking to the ActionCable API. However, the graphs made me curious about comparisons to other languages than just Go and Erlang. For instance, it'd be cool to use the graph to ballpark how much faster switching from node Faye to AnyCable-Go or ErlyCable might be. And also it'd just be interesting to see a few of the other popular languages in the graph. If this isn't something you're interested in, is there anything you can provide for how someone else might run the same benchmarks for different platforms?

Thanks!

Random Segmentation Fault crash in production

Tell us about your environment

AnyCable-Go version: 1.0

AnyCable gem version: 1.0.2

Ruby version : 2.7.1p83

What did you do?

We launched anycable in production

What did you expect to happen?

No regression or added crash in production

What actually happened?

[BUG] Segmentation fault at 0x0000000000000000

We have seen some random deep crashes "Segmentation fault" in production when making http requests from the backend.
They appeared right after having deployed anycable in production for the first time.

From our investigations, this seems like an occurrence of the following bug caused by the direct and indirect addition of 2 gems from anycable : grpc and google-protobuf.

image

image

Please note that in the image the crash appears indirectly linked to the bearer gem because it wraps all network call.
Also please note that the crash is probably not directly linked to anycable code but rather to the following libs :

  • grpc
  • google-protobuf
    which version are not set in the gemspec :
spec.add_dependency "grpc", "~> 1.17"

A potential solution may be to force using the 1.17 version :

spec.add_dependency "grpc", "1.17"

We will try to fork the project and set the version in our project to see if this fixes the crash

Heroku deployment

Tell us about your environment

Ruby version:
2.4

anycable gem version:
0.6.2

grpc gem version:
1.17

What did you do?

Tried the Heroku recipe

What did you expect to happen?

Beautiful things

What actually happened?

Nothing

Hi,

I just have a question and I hope this is the right place to answer it. I am currently working on an app that will serve a specific amount of users( 1000 max) which I'd like to deploy on Heroku.
I have tried to follow your Heroku recipe (https://docs.anycable.io/#/heroku) but I have failed to get it to work. The truth is I'm a bit over my head and don't completely understand what I am doing. The overall idea is clear, but when it comes to debugging why things don't function properly I am nowhere.

That being said: do you think that I really need anycable for this amount of users on Heroku? Maybe a beefed-up standard dyno is enough? I would appreciate your take on this.

Thanks in advance

Cspr

AWS ECS - cannot deploy anycable

Ruby version: 2.6.6

**anycable gem version:1.0.1

**grpc gem version:1.30.0

What did you do?

I tried to deploy my app in AWS ECS. One container runs RoR app with GRPC server, the other container runs anycable-go server. This setup when run locally with docker-compose works fantastic. It is a challenge to make it work on AWS ECS though.

What did you expect to happen?

To run as smoothly as with docker-compose on my local environment.

What actually happened?

Anycable-go container cannot connect to GRPC server (running together with my ruby API). The log shows error:
E 2020-07-27T17:57:02.530Z context=ws Websocket session initialization failed: rpc error: code = Unavailable desc = last connection error: connection error: desc = "transport: Error while dialing dial tcp: lookup API on 10.0.0.2:53: no such host"

I believe this is a network issue (probably ENVs are incorrect or I am missing some).

My ENVs for actioncable-go container:

ANYCABLE_HOST=0.0.0.0
ANYCABLE_RPC_HOST=API:50051 (where API is name for my API with GRPC server)
REDIS_URL=my redis endpoint (working for sure)

MY ENVs for api + gcpr container:

REDIS_URL=my redis endpoint (working for sure)
ANYCABLE_RPC_HOST=0.0.0.0:50051
CABLE_URL=ws://localhost:8080/cable
RAILS_ENV=production

I really appreciate any help cause I'm stucked. Thank you for you great work!

Heroku Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

Thanks, @palkan for your work on this gem. Please, can you help take a look at this problem with Boot timeout on Heroku? Any idea why this is happening?

**Ruby version:2.5.3

**anycable gem version:0.6.0

grpc gem version:

What did you do?

Trying to deploy on Heroku.

What did you expect to happen?

Successful deploy and starting of application

What actually happened?

App crashed after successful deploy and during the starting process.

Profile

web: bundle exec rails s -p 3000 -b 0.0.0.0
worker: bundle exec sidekiq -q mailers -q default -q notifications -L log/sidekiq.log
ws: anycable-go --host=0.0.0.0 --port=3334
rpc: bundle exec anycable --rpc_host=0.0.0.0:50051

Here's the server logs on Heroku

2018-12-07T00:21:07.332913+00:00 heroku[web.1]: Starting process with command `/bin/sh -c bundle\ exec\ foreman\ start\ -f\ Procfile.prod`

2018-12-07T00:21:20.187126+00:00 app[web.1]: D, [2018-12-07T00:21:20.186947 #5] DEBUG -- :   [1m[35m (1.3ms)[0m  [1m[34mSELECT pg_try_advisory_lock(5837494677641363520)[0m

2018-12-07T00:21:20.266438+00:00 app[web.1]: D, [2018-12-07T00:21:20.266299 #5] DEBUG -- :   [1m[35m (7.5ms)[0m  [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m

2018-12-07T00:21:20.294461+00:00 app[web.1]: D, [2018-12-07T00:21:20.294339 #5] DEBUG -- :   [1m[36mActiveRecord::InternalMetadata Load (4.2ms)[0m  [1m[34mSELECT  "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2[0m  [["key", "environment"], ["LIMIT", 1]]

2018-12-07T00:21:20.316648+00:00 app[web.1]: D, [2018-12-07T00:21:20.316521 #5] DEBUG -- :   [1m[35m (7.4ms)[0m  [1m[35mBEGIN[0m

2018-12-07T00:21:20.319563+00:00 app[web.1]: D, [2018-12-07T00:21:20.319494 #5] DEBUG -- :   [1m[35m (1.0ms)[0m  [1m[35mCOMMIT[0m

2018-12-07T00:21:20.320958+00:00 app[web.1]: D, [2018-12-07T00:21:20.320904 #5] DEBUG -- :   [1m[35m (0.9ms)[0m  [1m[34mSELECT pg_advisory_unlock(5837494677641363520)[0m

2018-12-07T00:21:21.345809+00:00 app[web.1]: 00:21:21 web.1    | started with pid 10

2018-12-07T00:21:21.345874+00:00 app[web.1]: 00:21:21 worker.1 | started with pid 11

2018-12-07T00:21:21.345973+00:00 app[web.1]: 00:21:21 ws.1     | started with pid 14

2018-12-07T00:21:21.346068+00:00 app[web.1]: 00:21:21 rpc.1    | started with pid 17

2018-12-07T00:21:21.373556+00:00 app[web.1]: 00:21:21 ws.1     | I 2018-12-07T00:21:21.368Z context=main Starting AnyCable 0.6.0-unknown (pid: 18)

2018-12-07T00:21:21.374165+00:00 app[web.1]: 00:21:21 ws.1     | I 2018-12-07T00:21:21.373Z context=main Handle WebSocket connections at /cable

2018-12-07T00:21:21.375908+00:00 app[web.1]: 00:21:21 ws.1     | I 2018-12-07T00:21:21.375Z context=rpc RPC pool initialized: localhost:50051

2018-12-07T00:21:21.379287+00:00 app[web.1]: 00:21:21 ws.1     | I 2018-12-07T00:21:21.378Z context=http Starting HTTP server at 0.0.0.0:3334

2018-12-07T00:21:21.469793+00:00 app[web.1]: 00:21:21 ws.1     | I 2018-12-07T00:21:21.469Z context=pubsub Subscribed to Redis channel: __anycable__

2018-12-07T00:21:21.469879+00:00 app[web.1]: 00:21:21 ws.1     | 

2018-12-07T00:21:27.843728+00:00 app[web.1]: 00:21:27 web.1    | => Booting Puma

2018-12-07T00:21:27.843966+00:00 app[web.1]: 00:21:27 web.1    | => Rails 5.2.1 application starting in staging 

2018-12-07T00:21:27.844145+00:00 app[web.1]: 00:21:27 web.1    | => Run `rails server -h` for more startup options

2018-12-07T00:21:32.953939+00:00 app[web.1]: 00:21:32 web.1    | [13] Puma starting in cluster mode...

2018-12-07T00:21:32.954206+00:00 app[web.1]: 00:21:32 web.1    | [13] * Version 3.12.0 (ruby 2.5.3-p105), codename: Llamas in Pajamas

2018-12-07T00:21:32.954356+00:00 app[web.1]: 00:21:32 web.1    | [13] * Min threads: 0, max threads: 2

2018-12-07T00:21:32.954513+00:00 app[web.1]: 00:21:32 web.1    | [13] * Environment: development

2018-12-07T00:21:32.954694+00:00 app[web.1]: 00:21:32 web.1    | [13] * Process workers: 2

2018-12-07T00:21:32.954843+00:00 app[web.1]: 00:21:32 web.1    | [13] * Preloading application

2018-12-07T00:21:32.954962+00:00 app[web.1]: 00:21:32 web.1    | [13] * Listening on tcp://0.0.0.0:3000

2018-12-07T00:21:32.955213+00:00 app[web.1]: 00:21:32 web.1    | [13] Use Ctrl-C to stop

2018-12-07T00:21:32.973172+00:00 app[web.1]: 00:21:32 web.1    | [13] - Worker 0 (pid: 40) booted, phase: 0

2018-12-07T00:21:32.989519+00:00 app[web.1]: 00:21:32 web.1    | [13] - Worker 1 (pid: 49) booted, phase: 0

2018-12-07T00:21:34.340624+00:00 app[web.1]: 00:21:34 rpc.1    | I, [2018-12-07T00:21:34.340246 #19]  INFO -- : Starting AnyCable gRPC server (pid: 19)

2018-12-07T00:21:34.340978+00:00 app[web.1]: 00:21:34 rpc.1    | I, [2018-12-07T00:21:34.340406 #19]  INFO -- : AnyCable version: 0.6.0

2018-12-07T00:21:34.341138+00:00 app[web.1]: 00:21:34 rpc.1    | I, [2018-12-07T00:21:34.340460 #19]  INFO -- : gRPC version: 1.17.0

2018-12-07T00:21:34.341341+00:00 app[web.1]: 00:21:34 rpc.1    | I, [2018-12-07T00:21:34.340509 #19]  INFO -- : Serving Rails application from ./config/environment.rb

2018-12-07T00:21:34.357525+00:00 app[web.1]: 00:21:34 rpc.1    | I, [2018-12-07T00:21:34.355046 #19]  INFO -- : Broadcasting Redis channel: __anycable__

2018-12-07T00:21:34.357842+00:00 app[web.1]: 00:21:34 rpc.1    | I, [2018-12-07T00:21:34.355157 #19]  INFO -- : RPC server is starting...

2018-12-07T00:21:34.509536+00:00 app[web.1]: 00:21:34 rpc.1    | I, [2018-12-07T00:21:34.506729 #19]  INFO -- : RPC server is listening on 0.0.0.0:50051

2018-12-07T00:21:47.169518+00:00 app[web.1]: 00:21:47 worker.1 | D, [2018-12-07T00:21:47.167828 #12] DEBUG -- :   [1m[36mAppointment Load (1.7ms)[0m  [1m[34mSELECT  "appointments".* FROM "appointments" WHERE "appointments"."id" = $1 LIMIT $2[0m  [["id", 36], ["LIMIT", 1]]

2018-12-07T00:21:47.191064+00:00 app[web.1]: 00:21:47 worker.1 | I, [2018-12-07T00:21:47.190728 #12]  INFO -- : [Rollbar] Scheduling item

2018-12-07T00:21:47.194068+00:00 app[web.1]: 00:21:47 worker.1 | I, [2018-12-07T00:21:47.193793 #12]  INFO -- : [Rollbar] Details: https://rollbar.com/instance/uuid?uuid=657d6c86-bd42-4f03-9b8e-de3b1cd3699a (only available if report was successful)

2018-12-07T00:22:07.838698+00:00 heroku[web.1]: State changed from starting to crashed

2018-12-07T00:22:07.634512+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

2018-12-07T00:22:07.634753+00:00 heroku[web.1]: Stopping process with SIGKILL

2018-12-07T00:22:07.787393+00:00 heroku[web.1]: Process exited with status 137

Running on Heroku Standard x2 Dyno

Any idea why the Boot timeout?

Ability to broadcast back from channel class synchronously to a received message

Hi guys. First of all let me thank you for the excellent job you guys have done here.

I'm having a hard time figuring out this: can we broadcast back directly from a Channel class without using a background job?

Right now I'm trying this use case:

class ConversationChannel < ApplicationCable::Channel
  def subscribed
    stop_all_streams
    stream_from(conversation_channel)
    stream_for(conversation_channel)
  end

  def receive(data); end

  def unsubscribed; end

  def send_message(data)
    message = create_message_service(data).call

    # This broadcast only goes through if sent asynchronously on a background job
    ActionCable.server.broadcast(conversation_channel, { data: message })
  end

  private

  def conversation
    current_user.conversation
  end

  def conversation_channel
    "conversation/#{conversation.id}"
  end
end

Should this work with Anycable?

Tell us about your environment

Ruby version: 2.5.3

anycable gem version: 0.6.0

grpc gem version: 1.17.0

localhost vs. 0.0.0.0

On my PaaS, aptible, here's what I'm currently using in my Procfile (not production yet)

anycable: exec bundle exec anycable --server-command="anycable-go --host=0.0.0.0 --health-path='/healthcheck'"

--host=0.0.0.0 was something that took a while for me to debug, I wonder if it should be mentioned somewhere in the docs. Maybe this isn't required on Heroku.

Envoy не балансирует

Привет, @palkan!

Procfile:
rpc1: ANYCABLE_RPC_HOST=0.0.0.0:50060 bundle exec ./bin/anycable
rpc2: ANYCABLE_RPC_HOST=0.0.0.0:50061 bundle exec ./bin/anycable
anycable-go: bundle exec ./bin/anycable-go --host=0.0.0.0 --port=3334

Envoy запустил, как в примере.

При коннекте на ws выдаёт ошибку:
context=ws Websocket session initialization failed: rpc error: code = Unavailable desc = upstream connect error or disconnect/reset before headers

v 0.4.0 - not work

v 0.4.0 - not work

`RPC Error: rpc error: code = 2 desc = no reason given
2017/01/23 19:56:14 http: panic serving 127.0.0.1:54399: runtime error: invalid memory address or nil pointer dereference
goroutine 54 [running]:
net/http.(*conn).serve.func1(0xc420246000)
/usr/local/go1.8beta2/src/net/http/server.go:1709 +0xd0
panic(0x140a8a0, 0x1696bd0)
/usr/local/go1.8beta2/src/runtime/panic.go:489 +0x2cf
main.serveWs(0x16721e0, 0xc42024e000, 0xc4201e8100)
/Users/nerzh/gopath/src/github.com/anycable/anycable-go/server.go:141 +0x1e3
net/http.HandlerFunc.ServeHTTP(0x149f260, 0x16721e0, 0xc42024e000, 0xc4201e8100)
/usr/local/go1.8beta2/src/net/http/server.go:1930 +0x44
net/http.(*ServeMux).ServeHTTP(0x16a4a00, 0x16721e0, 0xc42024e000, 0xc4201e8100)
/usr/local/go1.8beta2/src/net/http/server.go:2226 +0x130
net/http.serverHandler.ServeHTTP(0xc4201684d0, 0x16721e0, 0xc42024e000, 0xc4201e8100)
/usr/local/go1.8beta2/src/net/http/server.go:2556 +0x92
net/http.(*conn).serve(0xc420246000, 0x1672a20, 0xc4201c02c0)
/usr/local/go1.8beta2/src/net/http/server.go:1813 +0x612
created by net/http.(*Server).Serve
/usr/local/go1.8beta2/src/net/http/server.go:2656 +0x2ce

2017/01/23 19:58:07 transport: http2Client.notifyError got notified that the client transport was broken EOF.`

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.