Fragment Context
You should not make an instance of the FragmentContext class yourself, rather you should only
get instances through websocket.stream.writer.WebSocketWriter.fragment()
>>> async with client.writer.fragment() as stream:
... stream.send('Hello ')
... stream.send("World!")
-
class
websocket.stream.fragment.
FragmentContext
(writer, loop)[source]
A context manager that can send fragments to a client.
-
send
(data, force=False)[source]
Que a message to be sent.
Parameters: |
- data (either str or bytes) – The data you with to send, must be either
str or bytes .
- force (bool) – If true send message even if the connection is closing e.g. we got valid message after having previously been sent a close frame from the client or after having received invalid frame(s)
|