Class EventMachine::WebSocket::Connection
In: lib/em-websocket/connection.rb
Parent: EventMachine::Connection

Methods

Included Modules

Debugger

Constants

ENCODING_SUPPORTED = "string".respond_to?(:force_encoding)   Cache encodings since it‘s moderately expensive to look them up each time
UTF8 = Encoding.find("UTF-8") if ENCODING_SUPPORTED
BINARY = Encoding.find("BINARY") if ENCODING_SUPPORTED

Attributes

max_frame_size  [W] 

Public Class methods

Public Instance methods

Use this method to close the websocket connection cleanly This sends a close frame and waits for acknowlegement before closing the connection

Returns the maximum frame size which this connection is configured to accept. This can be set globally or on a per connection basis, and defaults to a value of 10MB if not set.

The behaviour when a too large frame is received varies by protocol, but in the newest protocols the connection will be closed with the correct close code (1009) immediately after receiving the frame header

define WebSocket callbacks

Send a ping to the client. The client must respond with a pong.

In the case that the client is running a WebSocket draft < 01, false is returned since ping & pong are not supported

Test whether the connection is pingable (i.e. the WebSocket draft in use is >= 01)

Send an unsolicited pong message, as allowed by the protocol. The client is not expected to respond to this message.

em-websocket automatically takes care of sending pong replies to incoming ping messages, as the protocol demands.

Send a WebSocket text frame.

A WebSocketError may be raised if the connection is in an opening or a closing state, or if the passed in data is not valid UTF-8

[Validate]