webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Public Member Functions | List of all members
webkitpy.thirdparty.mod_pywebsocket.msgutil.MessageReceiver Class Reference
Inheritance diagram for webkitpy.thirdparty.mod_pywebsocket.msgutil.MessageReceiver:

Public Member Functions

def __init__ (self, request, onmessage=None)
 
def run (self)
 
def receive (self)
 
def receive_nowait (self)
 
def stop (self)
 

Detailed Description

This class receives messages from the client.

This class provides three ways to receive messages: blocking,
non-blocking, and via callback. Callback has the highest precedence.

Note: This class should not be used with the standalone server for wss
because pyOpenSSL used by the server raises a fatal error if the socket
is accessed from multiple threads.

Constructor & Destructor Documentation

◆ __init__()

def webkitpy.thirdparty.mod_pywebsocket.msgutil.MessageReceiver.__init__ (   self,
  request,
  onmessage = None 
)
Construct an instance.

Args:
    request: mod_python request.
    onmessage: a function to be called when a message is received.
       May be None. If not None, the function is called on
       another thread. In that case, MessageReceiver.receive
       and MessageReceiver.receive_nowait are useless
       because they will never return any messages.

Member Function Documentation

◆ receive()

def webkitpy.thirdparty.mod_pywebsocket.msgutil.MessageReceiver.receive (   self)
Receive a message from the channel, blocking.

Returns:
    message as a unicode string.

◆ receive_nowait()

def webkitpy.thirdparty.mod_pywebsocket.msgutil.MessageReceiver.receive_nowait (   self)
Receive a message from the channel, non-blocking.

Returns:
    message as a unicode string if available. None otherwise.

◆ run()

def webkitpy.thirdparty.mod_pywebsocket.msgutil.MessageReceiver.run (   self)

◆ stop()

def webkitpy.thirdparty.mod_pywebsocket.msgutil.MessageReceiver.stop (   self)
Request to stop this instance.

The instance will be stopped after receiving the next message.
This method may not be very useful, but there is no clean way
in Python to forcefully stop a running thread.

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