lib/lite_cable/server/middleware.rb in litecable-0.4.0 vs lib/lite_cable/server/middleware.rb in litecable-0.4.1

- old
+ new

@@ -1,9 +1,8 @@ # frozen_string_literal: true module LiteCable module Server - require "lite_cable/server/websocket_ext/protocols" # Rack middleware to hijack the socket class Middleware class HijackNotAvailable < RuntimeError; end def initialize(_app, connection_class:) @@ -28,13 +27,14 @@ end private def send_handshake(env) - handshake = WebSocket::Handshake::Server.new - handshake.from_rack env - handshake.protocols LiteCable::INTERNAL[:protocols] + handshake = WebSocket::Handshake::Server.new( + protocols: LiteCable::INTERNAL[:protocols] + ) + handshake.from_rack env env['rack.hijack_io'].write handshake.to_s handshake end def init_connection(socket)