pondsocket 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pondsocket/__init__.py +205 -0
- pondsocket/channel.py +580 -0
- pondsocket/contexts/__init__.py +16 -0
- pondsocket/contexts/connection_context.py +135 -0
- pondsocket/contexts/event_context.py +127 -0
- pondsocket/contexts/join_context.py +162 -0
- pondsocket/contexts/leave_context.py +78 -0
- pondsocket/contexts/outgoing_context.py +72 -0
- pondsocket/distributed/__init__.py +5 -0
- pondsocket/distributed/redis_pubsub.py +137 -0
- pondsocket/endpoint.py +348 -0
- pondsocket/errors.py +90 -0
- pondsocket/hooks.py +227 -0
- pondsocket/in_memory_transport.py +112 -0
- pondsocket/lobby.py +183 -0
- pondsocket/middleware.py +100 -0
- pondsocket/parser.py +85 -0
- pondsocket/presence.py +109 -0
- pondsocket/pubsub.py +44 -0
- pondsocket/pubsub_local.py +85 -0
- pondsocket/py.typed +0 -0
- pondsocket/server.py +88 -0
- pondsocket/sse_transport.py +122 -0
- pondsocket/store.py +83 -0
- pondsocket/transport.py +29 -0
- pondsocket/types.py +154 -0
- pondsocket/wire.py +87 -0
- pondsocket-0.0.1.dist-info/METADATA +144 -0
- pondsocket-0.0.1.dist-info/RECORD +30 -0
- pondsocket-0.0.1.dist-info/WHEEL +4 -0
pondsocket/__init__.py
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
4
|
+
|
|
5
|
+
from pondsocket_common import (
|
|
6
|
+
ChannelReceiver,
|
|
7
|
+
Headers,
|
|
8
|
+
IncomingConnection,
|
|
9
|
+
JoinParams,
|
|
10
|
+
PondAssigns,
|
|
11
|
+
PondMessage,
|
|
12
|
+
PondPresence,
|
|
13
|
+
PresenceEventTypes,
|
|
14
|
+
ServerActions,
|
|
15
|
+
UserData,
|
|
16
|
+
uuid,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
from .channel import Channel, ChannelOptions
|
|
20
|
+
from .contexts import (
|
|
21
|
+
ConnectionContext,
|
|
22
|
+
ConnectionDecision,
|
|
23
|
+
EventContext,
|
|
24
|
+
JoinContext,
|
|
25
|
+
LeaveContext,
|
|
26
|
+
OutgoingContext,
|
|
27
|
+
)
|
|
28
|
+
from .endpoint import (
|
|
29
|
+
ConnectionHandler,
|
|
30
|
+
ConnectionMiddlewareFn,
|
|
31
|
+
Endpoint,
|
|
32
|
+
JoinHandler,
|
|
33
|
+
JoinMiddlewareFn,
|
|
34
|
+
)
|
|
35
|
+
from .errors import (
|
|
36
|
+
MultiError,
|
|
37
|
+
PondError,
|
|
38
|
+
bad_request,
|
|
39
|
+
conflict,
|
|
40
|
+
error_event,
|
|
41
|
+
forbidden,
|
|
42
|
+
internal,
|
|
43
|
+
not_found,
|
|
44
|
+
too_many_requests,
|
|
45
|
+
unauthorized,
|
|
46
|
+
)
|
|
47
|
+
from .hooks import (
|
|
48
|
+
AfterJoin,
|
|
49
|
+
AfterMessage,
|
|
50
|
+
BeforeJoin,
|
|
51
|
+
BeforeMessage,
|
|
52
|
+
Hooks,
|
|
53
|
+
MetricsCollector,
|
|
54
|
+
NoopMetrics,
|
|
55
|
+
OnConnect,
|
|
56
|
+
OnDisconnect,
|
|
57
|
+
RateLimiter,
|
|
58
|
+
TokenBucketRateLimiter,
|
|
59
|
+
with_metrics,
|
|
60
|
+
with_rate_limiter,
|
|
61
|
+
)
|
|
62
|
+
from .in_memory_transport import InMemoryTransport
|
|
63
|
+
from .lobby import EventHandler, EventMiddlewareFn, LeaveHandler, Lobby, OutgoingHandler
|
|
64
|
+
from .middleware import Middleware
|
|
65
|
+
from .parser import parse
|
|
66
|
+
from .presence import PresenceClient
|
|
67
|
+
from .pubsub import (
|
|
68
|
+
PubSub,
|
|
69
|
+
PubSubClosedError,
|
|
70
|
+
format_message_topic,
|
|
71
|
+
format_presence_topic,
|
|
72
|
+
format_system_topic,
|
|
73
|
+
format_topic,
|
|
74
|
+
match_topic,
|
|
75
|
+
)
|
|
76
|
+
from .pubsub_local import LocalPubSub
|
|
77
|
+
from .server import EndpointMatch, PondSocket
|
|
78
|
+
from .sse_transport import SSEServerTransport
|
|
79
|
+
from .store import Store
|
|
80
|
+
from .transport import OnCloseCallback, OnMessageHandler, PushableTransport, Transport
|
|
81
|
+
from .types import (
|
|
82
|
+
AllExceptSender,
|
|
83
|
+
AllUsers,
|
|
84
|
+
Event,
|
|
85
|
+
InternalActions,
|
|
86
|
+
LeaveReason,
|
|
87
|
+
MessageEvent,
|
|
88
|
+
Options,
|
|
89
|
+
RecipientSpec,
|
|
90
|
+
Route,
|
|
91
|
+
SystemEntity,
|
|
92
|
+
SystemEvents,
|
|
93
|
+
ToUsers,
|
|
94
|
+
TransportType,
|
|
95
|
+
User,
|
|
96
|
+
)
|
|
97
|
+
from .wire import (
|
|
98
|
+
event_to_json,
|
|
99
|
+
event_to_pubsub_bytes,
|
|
100
|
+
event_to_wire,
|
|
101
|
+
parse_inbound_text,
|
|
102
|
+
pubsub_bytes_to_event,
|
|
103
|
+
wire_to_event,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
try:
|
|
107
|
+
__version__ = version("pondsocket")
|
|
108
|
+
except PackageNotFoundError:
|
|
109
|
+
__version__ = "0.0.1"
|
|
110
|
+
|
|
111
|
+
__all__ = [
|
|
112
|
+
"AfterJoin",
|
|
113
|
+
"AfterMessage",
|
|
114
|
+
"AllExceptSender",
|
|
115
|
+
"AllUsers",
|
|
116
|
+
"BeforeJoin",
|
|
117
|
+
"BeforeMessage",
|
|
118
|
+
"Channel",
|
|
119
|
+
"ChannelOptions",
|
|
120
|
+
"ChannelReceiver",
|
|
121
|
+
"ConnectionContext",
|
|
122
|
+
"ConnectionDecision",
|
|
123
|
+
"ConnectionHandler",
|
|
124
|
+
"ConnectionMiddlewareFn",
|
|
125
|
+
"Endpoint",
|
|
126
|
+
"EndpointMatch",
|
|
127
|
+
"Event",
|
|
128
|
+
"EventContext",
|
|
129
|
+
"EventHandler",
|
|
130
|
+
"EventMiddlewareFn",
|
|
131
|
+
"Headers",
|
|
132
|
+
"Hooks",
|
|
133
|
+
"InMemoryTransport",
|
|
134
|
+
"IncomingConnection",
|
|
135
|
+
"InternalActions",
|
|
136
|
+
"JoinContext",
|
|
137
|
+
"JoinHandler",
|
|
138
|
+
"JoinMiddlewareFn",
|
|
139
|
+
"JoinParams",
|
|
140
|
+
"LeaveContext",
|
|
141
|
+
"LeaveHandler",
|
|
142
|
+
"LeaveReason",
|
|
143
|
+
"Lobby",
|
|
144
|
+
"LocalPubSub",
|
|
145
|
+
"MessageEvent",
|
|
146
|
+
"MetricsCollector",
|
|
147
|
+
"Middleware",
|
|
148
|
+
"MultiError",
|
|
149
|
+
"NoopMetrics",
|
|
150
|
+
"OnCloseCallback",
|
|
151
|
+
"OnConnect",
|
|
152
|
+
"OnDisconnect",
|
|
153
|
+
"OnMessageHandler",
|
|
154
|
+
"Options",
|
|
155
|
+
"OutgoingContext",
|
|
156
|
+
"OutgoingHandler",
|
|
157
|
+
"PondAssigns",
|
|
158
|
+
"PondError",
|
|
159
|
+
"PondMessage",
|
|
160
|
+
"PondPresence",
|
|
161
|
+
"PondSocket",
|
|
162
|
+
"PresenceClient",
|
|
163
|
+
"PresenceEventTypes",
|
|
164
|
+
"PubSub",
|
|
165
|
+
"PubSubClosedError",
|
|
166
|
+
"PushableTransport",
|
|
167
|
+
"RateLimiter",
|
|
168
|
+
"RecipientSpec",
|
|
169
|
+
"Route",
|
|
170
|
+
"SSEServerTransport",
|
|
171
|
+
"ServerActions",
|
|
172
|
+
"Store",
|
|
173
|
+
"SystemEntity",
|
|
174
|
+
"SystemEvents",
|
|
175
|
+
"ToUsers",
|
|
176
|
+
"TokenBucketRateLimiter",
|
|
177
|
+
"Transport",
|
|
178
|
+
"TransportType",
|
|
179
|
+
"User",
|
|
180
|
+
"UserData",
|
|
181
|
+
"__version__",
|
|
182
|
+
"bad_request",
|
|
183
|
+
"conflict",
|
|
184
|
+
"error_event",
|
|
185
|
+
"event_to_json",
|
|
186
|
+
"event_to_pubsub_bytes",
|
|
187
|
+
"event_to_wire",
|
|
188
|
+
"forbidden",
|
|
189
|
+
"format_message_topic",
|
|
190
|
+
"format_presence_topic",
|
|
191
|
+
"format_system_topic",
|
|
192
|
+
"format_topic",
|
|
193
|
+
"internal",
|
|
194
|
+
"match_topic",
|
|
195
|
+
"not_found",
|
|
196
|
+
"parse",
|
|
197
|
+
"parse_inbound_text",
|
|
198
|
+
"pubsub_bytes_to_event",
|
|
199
|
+
"too_many_requests",
|
|
200
|
+
"unauthorized",
|
|
201
|
+
"uuid",
|
|
202
|
+
"wire_to_event",
|
|
203
|
+
"with_metrics",
|
|
204
|
+
"with_rate_limiter",
|
|
205
|
+
]
|