WSClient (_rendezvous.py)

magic-wormhole · realtime, websocket-client, protocol-handshake, wormhole-protocol, integration

WebSocket client handling verified for Wormhole protocol

import os
from urllib.parse import urlparse
from attr import attrs, attrib
from attr.validators import instance_of, optional
from zope.interface import implementer
from twisted.python import log
from twisted.internet import defer, endpoints, task
from twisted.application import internet
from autobahn.twisted import websocket
from . import _interfaces, errors
from .util import (bytes_to_hexstr, hexstr_to_bytes, bytes_to_dict,
                   dict_to_bytes, provides)

from ._status import Connecting, Connected


class WSClient(websocket.WebSocketClientProtocol):
    def onConnect(self, response):
        # this fires during WebSocket negotiation, and isn't very useful
        # unless you want to modify the protocol settings
        pass

    def onOpen(self, *args):
        # this fires 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key