MCPcopy Create free account
hub / github.com/python-websockets/websockets / serialize

Method serialize

src/websockets/http11.py:169–178  ·  view source on GitHub ↗

Serialize a WebSocket handshake request.

(self)

Source from the content-addressed store, hash-verified

167 return cls(path, headers)
168
169 def serialize(self) -> bytes:
170 """
171 Serialize a WebSocket handshake request.
172
173 """
174 # Since the request line and headers only contain ASCII characters,
175 # we can keep this simple.
176 request = f"GET {self.path} HTTP/1.1\r\n".encode()
177 request += self.headers.serialize()
178 return request
179
180
181@dataclasses.dataclass

Callers 2

test_serializeMethod · 0.95
serializeMethod · 0.45

Calls 1

encodeMethod · 0.45

Tested by 1

test_serializeMethod · 0.76