no outbound websocket traffic

Hello. I’m not sure if this is a setup issue that I caused with fly.io, a misconfiguration of my app, or something else. I have a Rails apps that makes use of web sockets. Everything works locally. Everything works when deployed to fly except outbound websockets communication, or so I think because the server is accepting a connection from the client. Below is a console test, which successfully sees pings coming from the server.

I have tried various ActionCable backends in production, but the behavior is the same. I’ve not made any significant changes to the Dockerfile or fly.toml. I’m working with config files that were generated by flyctl a week or so ago. I’ve not made any material changes to it other than adding some env-vars and packages. The tutorials gave me the impression that I didn’t need to.

I’ve raised the log level, and I don’t see anything unusual. Rails is behaving as if websockets are working. It’s receiving connections, its pushing messages…the messages just aren’t making it to the outside work.

Is there something additional that I need to do?

websocat -v "wss://brandon.harmonic.fm/cable" -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: brandon.harmonic.fm" -H "Origin: https://brandon.harmonic.fm" -H "Sec-WebSocket-Key: NJCe8FWTH58Cq7/+lPzOaA==" -H "Sec-WebSocket-Version: 13" -H "Cookie: _commerce_app=OYhZBa3Xrs7wQiPecB2Oovu%2FXvN8q%2FYLRYDcfgouIxHz5S2AmpFm6%2B58zagfKdJa50Mx4v2KIEXZOcyru7NIOLuF4V6ZLHKOAfBAceR%2BMdl5MHrYQDosgFryDk4NUDGYqD4ZD8Yb7hF373Bk%2B04YpW8%2Bm7USu%2FVU8Ft6%2B2lKbqq1miVb7P4UXe6x0KJ%2FNM89iMPGzynqzezdXWOVTA5PoeHLpk41lDkWWC0LUg9DlfW8MPJCW2aqQe3EmcbgSwczVBv186VnY16ImPVKj6N2RCFShRk3iOqMlXvyP5ZRXKABotcN6QL%2F7ciCF47m5t7pgCsO9%2BgwmiV2XcPEZ3kIRBFP2QP51M3uwOmd4G12o5W%2F2TVkiqqOI4S1U6yebvzU%2F1qnVk2kK6m4WEhKAHaT0lyM8qXJx4DsGhk0ulurM%2BlJPdgEoecSa%2BM0F5d4bbZ0XuStZK0mHiO1iy92cji4UL6%2Bd7qI0EI6w0uRQEDFxIwlCweDvy4p6E2fsGKqiToaAFK1np9UUG%2FYGRpR7Pic--dV4vVNxAlPa8y3Iz--WEyEuJ%2FZLWHZagKwmOzvZg%3D%3D" 


[INFO  websocat::lints] Auto-inserting the line mode
[INFO  websocat::stdio_threaded_peer] get_stdio_peer (threaded)
[INFO  websocat::ws_client_peer] get_ws_client_peer
[INFO  websocat::net_peer] Connected to TCP 66.241.125.100:443
[INFO  websocat::ws_client_peer] Connected to ws
[INFO  websocat::ws_peer] incoming None
[INFO  websocat::sessionserve] Reverse finished
pp = 'harmonic-app-production'
primary_region = 'ewr'
console_command = '/rails/bin/rails console'

[build]

[[mounts]]
  source = 'data'
  destination = '/data'

[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = false
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[checks]
  [checks.status]
    port = 3000
    type = 'http'
    interval = '10s'
    timeout = '2s'
    grace_period = '5s'
    method = 'GET'
    path = '/up'
    protocol = 'http'
    tls_skip_verify = false

    [checks.status.headers]
      X-Forwarded-Proto = 'https'

[[vm]]
  memory = '1gb'
  cpu_kind = 'shared'
  cpus = 1

[[statics]]
  guest_path = '/rails/public'
  url_prefix = '/'
pp = 'harmonic-app-production'
primary_region = 'ewr'
console_command = '/rails/bin/rails console'

[build]

[[mounts]]
  source = 'data'
  destination = '/data'

[http_service]
  internal_port = 3000
  force_https = true
  auto_stop_machines = false
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[checks]
  [checks.status]
    port = 3000
    type = 'http'
    interval = '10s'
    timeout = '2s'
    grace_period = '5s'
    method = 'GET'
    path = '/up'
    protocol = 'http'
    tls_skip_verify = false

    [checks.status.headers]
      X-Forwarded-Proto = 'https'

[[vm]]
  memory = '1gb'
  cpu_kind = 'shared'
  cpus = 1

[[statics]]
  guest_path = '/rails/public'
  url_prefix = '/'

I figured out the issue after finding something in the documentation that mentions websockets are not possible with LiteFS without running your own proxy. I deployed a new machine without LiteFS and everything worked. Maybe I’m misunderstanding what the limitation is, and why the proxy solution is necessary, but I think I will not be using LiteFS for now since it requires introducing middleware to my app. I have concerns about the performance and complexity…though someone please correct me if I’m wrong.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.