Clarify that WebSocket.{recv,recvmsg} may return empty messages
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
a29946e978
commit
b0df514344
|
@ -342,10 +342,11 @@ class WebSocket(object):
|
||||||
def recv(self):
|
def recv(self):
|
||||||
"""Read data from the WebSocket.
|
"""Read data from the WebSocket.
|
||||||
|
|
||||||
This will return any available data on the socket. If the
|
This will return any available data on the socket (which may
|
||||||
socket is closed then None will be returned. The reason for
|
be the empty string if the peer sent an empty message or
|
||||||
the close is found in the 'close_code' and 'close_reason'
|
messages). If the socket is closed then None will be
|
||||||
properties.
|
returned. The reason for the close is found in the
|
||||||
|
'close_code' and 'close_reason' properties.
|
||||||
|
|
||||||
Unlike recvmsg() this method may return data from more than one
|
Unlike recvmsg() this method may return data from more than one
|
||||||
WebSocket message. It is however not guaranteed to return all
|
WebSocket message. It is however not guaranteed to return all
|
||||||
|
@ -360,10 +361,11 @@ class WebSocket(object):
|
||||||
def recvmsg(self):
|
def recvmsg(self):
|
||||||
"""Read a single message from the WebSocket.
|
"""Read a single message from the WebSocket.
|
||||||
|
|
||||||
This will return a single WebSocket message from the socket.
|
This will return a single WebSocket message from the socket
|
||||||
If the socket is closed then None will be returned. The
|
(which will be the empty string if the peer sent an empty
|
||||||
reason for the close is found in the 'close_code' and
|
message). If the socket is closed then None will be
|
||||||
'close_reason' properties.
|
returned. The reason for the close is found in the
|
||||||
|
'close_code' and 'close_reason' properties.
|
||||||
|
|
||||||
Unlike recv() this method will not return data from more than
|
Unlike recv() this method will not return data from more than
|
||||||
one WebSocket message. Callers should continue calling
|
one WebSocket message. Callers should continue calling
|
||||||
|
|
Loading…
Reference in New Issue