Rails 5 ActionCable WebSockets is not returning upgrade headers with status 101 Upgrade response

前端 未结 1 957
逝去的感伤
逝去的感伤 2021-01-19 15:48

EDIT: Shown at end, found that upgrade headers were actually created.

I\'m working from the action-cable-example codebase, trying to build a WebSocket app. The \"Ch

相关标签:
1条回答
  • 2021-01-19 16:30

    The problem was that I was trying to use the Thin server in development. It would operate. However, it was actually transmitting the response headers during its processing, such as this:

    Response Headers
    Connection:keep-alive
    Server:thin
    

    ActionCable was actually sending the appropriate upgrade headers, but it was doing so only after Thin had sent out its own headers so the client didn't recognize them.

    After converting back to Puma, I receive these as expected:

    Response Headers
    HTTP/1.1 101 Switching Protocols
    Upgrade: websocket
    Connection: Upgrade
    Sec-WebSocket-Accept: XJOmp1e2IwQIMk5n0JV/RZZSIhs=
    
    0 讨论(0)
提交回复
热议问题