webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Public Member Functions | List of all members
webkitpy.thirdparty.mod_pywebsocket._stream_hybi.Stream Class Reference
Inheritance diagram for webkitpy.thirdparty.mod_pywebsocket._stream_hybi.Stream:
webkitpy.thirdparty.mod_pywebsocket._stream_base.StreamBase webkitpy.thirdparty.mod_pywebsocket.mux._LogicalStream

Public Member Functions

def __init__ (self, request, options)
 
def receive_filtered_frame (self)
 
def send_message (self, message, end=True, binary=False)
 
def receive_message (self)
 
def close_connection (self, code=common.STATUS_NORMAL_CLOSURE, reason='', wait_response=True)
 
def send_ping (self, body='')
 
def get_last_received_opcode (self)
 
- Public Member Functions inherited from webkitpy.thirdparty.mod_pywebsocket._stream_base.StreamBase
def __init__ (self, request)
 
def receive_bytes (self, length)
 

Detailed Description

A class for parsing/building frames of the WebSocket protocol
(RFC 6455).

Constructor & Destructor Documentation

◆ __init__()

def webkitpy.thirdparty.mod_pywebsocket._stream_hybi.Stream.__init__ (   self,
  request,
  options 
)
Constructs an instance.

Args:
    request: mod_python request.

Member Function Documentation

◆ close_connection()

def webkitpy.thirdparty.mod_pywebsocket._stream_hybi.Stream.close_connection (   self,
  code = common.STATUS_NORMAL_CLOSURE,
  reason = '',
  wait_response = True 
)
Closes a WebSocket connection.

Args:
    code: Status code for close frame. If code is None, a close
frame with empty body will be sent.
    reason: string representing close reason.
    wait_response: True when caller want to wait the response.
Raises:
    BadOperationException: when reason is specified with code None
    or reason is not an instance of both str and unicode.

◆ get_last_received_opcode()

def webkitpy.thirdparty.mod_pywebsocket._stream_hybi.Stream.get_last_received_opcode (   self)
Returns the opcode of the WebSocket message which the last received
frame belongs to. The return value is valid iff immediately after
receive_message call.

◆ receive_filtered_frame()

def webkitpy.thirdparty.mod_pywebsocket._stream_hybi.Stream.receive_filtered_frame (   self)
Receives a frame and applies frame filters and message filters.
The frame to be received must satisfy following conditions:
- The frame is not fragmented.
- The opcode of the frame is TEXT or BINARY.

DO NOT USE this method except for testing purpose.

◆ receive_message()

def webkitpy.thirdparty.mod_pywebsocket._stream_hybi.Stream.receive_message (   self)
Receive a WebSocket frame and return its payload as a text in
unicode or a binary in str.

Returns:
    payload data of the frame
    - as unicode instance if received text frame
    - as str instance if received binary frame
    or None iff received closing handshake.
Raises:
    BadOperationException: when called on a client-terminated
connection.
    ConnectionTerminatedException: when read returns empty
string.
    InvalidFrameException: when the frame contains invalid
data.
    UnsupportedFrameException: when the received frame has
flags, opcode we cannot handle. You can ignore this
exception and continue receiving the next frame.

◆ send_message()

def webkitpy.thirdparty.mod_pywebsocket._stream_hybi.Stream.send_message (   self,
  message,
  end = True,
  binary = False 
)
Send message.

Args:
    message: text in unicode or binary in str to send.
    binary: send message as binary frame.

Raises:
    BadOperationException: when called on a server-terminated
connection or called with inconsistent message type or
binary parameter.

◆ send_ping()

def webkitpy.thirdparty.mod_pywebsocket._stream_hybi.Stream.send_ping (   self,
  body = '' 
)

The documentation for this class was generated from the following file: