Send the data as string. Parameters ---------- payload: str Payload must be utf-8 string or unicode, If the opcode is OPCODE_TEXT. Otherwise, it must be string(byte array). opcode: int Operation code (opcode) t
(self, payload: Union[bytes, str], opcode: int = ABNF.OPCODE_TEXT)
| 287 | raise |
| 288 | |
| 289 | def send(self, payload: Union[bytes, str], opcode: int = ABNF.OPCODE_TEXT) -> int: |
| 290 | """ |
| 291 | Send the data as string. |
| 292 | |
| 293 | Parameters |
| 294 | ---------- |
| 295 | payload: str |
| 296 | Payload must be utf-8 string or unicode, |
| 297 | If the opcode is OPCODE_TEXT. |
| 298 | Otherwise, it must be string(byte array). |
| 299 | opcode: int |
| 300 | Operation code (opcode) to send. |
| 301 | """ |
| 302 | |
| 303 | frame = ABNF.create_frame(payload, opcode) |
| 304 | return self.send_frame(frame) |
| 305 | |
| 306 | def send_text(self, text_data: str) -> int: |
| 307 | """ |