Method: ActionCable::Connection::ClientSocket#close
- Defined in:
- actioncable/lib/action_cable/connection/client_socket.rb
#close(code = nil, reason = nil) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'actioncable/lib/action_cable/connection/client_socket.rb', line 92 def close(code = nil, reason = nil) code ||= 1000 reason ||= "" unless code == 1000 || (code >= 3000 && code <= 4999) raise ArgumentError, "Failed to execute 'close' on WebSocket: " \ "The code must be either 1000, or between 3000 and 4999. " \ "#{code} is neither." end @ready_state = CLOSING unless @ready_state == CLOSED @driver.close(reason, code) end |