You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
-[3.2.3.3 Service channels](#3233-service-channels)
35
35
-[3.2.3.4 New session event](#3234-new-session-event)
36
36
-[3.2.3.5 Actor certificate invalidation event](#3235-actor-certificate-invalidation-event)
37
-
-[3.2.3.6 Resume event](#3236-resume-event)
37
+
-[3.2.3.6 "Resume" event and "resumed" event](#3236-resume-event-and-resumed-event)
38
38
-[3.2.3.7 Server certificate change event](#3237-server-certificate-change-event)
39
39
-[3.2.3.8 Heartbeat and heartbeat ACK events](#3238-heartbeat-and-heartbeat-ack-events)
40
40
-[3.2.4 Establishing a connection](#324-establishing-a-connection)
41
41
-[3.2.5 Closing a connection](#325-closing-a-connection)
42
42
-[3.2.6 Guaranteed delivery of gateway messages through package acknowledgement](#326-guaranteed-delivery-of-gateway-messages-through-package-acknowledgement)
43
-
-[3.3 Events over REST](#33-events-over-rest)
43
+
-[3.3 Events over events](#33-events-over-events)
44
44
-[3.4 HTTP](#34-http)
45
45
-[3.5 Internet Protocol (IP)](#35-internet-protocol-ip)
46
46
-[3.6 Compression](#36-compression)
@@ -271,11 +271,12 @@ The following opcodes are defined by the `core` namespace:
271
271
|`2`| Identify | Actor Send | Identify to the server. |
272
272
|`3`| New Session | Actor Receive | Received by all sessions except the new one. |
273
273
|`4`| Actor Certificate Invalidation | Actor Send/Receive | An actor certificate has been invalidated. Sent *to* server when an actor invalidates one of their certificates. |
274
-
|`5`| Resume | Actor Send/Receive | Replay events after re-connecting.|
274
+
|`5`| Resume | Actor Send| Request the replaying events after re-connecting.|
275
275
|`6`| Server Certificate Change | Actor Receive | Received when the server's certificate changed. |
276
276
|`7`| Heartbeat ACK | Actor Receive | Acknowledgement of a heartbeat |
277
277
|`8`| Service Channel | Actor Send/Receive | Open or close a service channel. |
278
278
|`9`| Service Channel ACK | Actor Receive | Acknowledgement of a service channel event. |
279
+
|`10`| Resumed | Actor Receive | Replayed events. |
279
280
280
281
##### 3.2.1.3 Sequence numbers `s`
281
282
@@ -335,7 +336,25 @@ in milliseconds at which the client should send heartbeat events to the server.
335
336
The "identify" event is sent by the client to the server to let the server know which actor the
|`token`| string | A [session token](#41-authentication) issued by the server, identifying the session the client wants to connect with. |
354
+
355
+
!!! info
356
+
357
+
This event may be extended in a backwards-compatible manner in future versions of polyproto.
339
358
340
359
##### 3.2.3.3 Service channels
341
360
@@ -461,12 +480,94 @@ occurs.
461
480
|`invalidSince`| uint64 | UNIX timestamp of the point in time where this ID-Cert became invalid on |
462
481
|`signature`| string | Signature of a string concatenation of the `invalidSince` timestamp and the `serial` number, in that order. Clients must verify this signature, verifying that the signature was generated by the private key of the revoked certificate. |
463
482
464
-
##### 3.2.3.6 Resume event
483
+
##### 3.2.3.6 "Resume" event and "resumed" event
465
484
466
485
When a client re-connects to a polyproto WebSocket gateway server, the client may send a resume event
467
-
to the server instead of identifying.
486
+
to the server instead of identifying. The resumed event sent by the server informs the client
487
+
about everything the client has missed since their last active connection to the gateway.
|`4000`| Unknown error | An unknown error has occurred and the connection was terminated. | x | x | x |
697
+
|`4001`| Unknown opcode | The client has sent a message with an unknown [opcode](#3212-opcodes-op) to the server. | x | x ||
698
+
|`4002`| Invalid payload | The client has sent a message with an invalid payload to the server. | x | x ||
699
+
|`4003`| Not authenticated | The server has received a message from the client before the client identified itself, or the clients' session has been invalidated. || x ||
700
+
|`4004`| Invalid authentication | The authentication token received by the server as part of the identify payload is invalid. || x ||
701
+
|`4005`| Already authenticated | The client has sent an identify payload even though it has already identified successfully. || x ||
702
+
|`4006`| Reserved | 4006 is a reserved value and has no function in polyproto v1.0. The specific meaning may be defined in the future. ||||
703
+
|`4007`| Invalid sequence number(s) | The client has sent a heartbeat containing sequence numbers that were invalid. | x | x ||
704
+
|`4008`| Rate limited | The client has sent payloads too quickly. || x ||
705
+
|`4009`| Timeout | The session has been deemed to be timed out. This can happen if a heartbeat or heartbeat ACK has not been sent in due time. | x (If sent by server) | x | x |
706
+
|`4010`| Unresumeable | The server has determined that this session cannot be resumed. The client should initiate a new, fresh connection to the gateway instead. || x ||
560
707
561
708
#### 3.2.6 Guaranteed delivery of gateway messages through package acknowledgement
562
709
563
-
TODO
564
-
565
-
!!! bug "TODO"
566
-
567
-
This section will explain how [heartbeats](#322-heartbeats) and [sequence numbers](#3213-sequence-numbers-s)
568
-
come together to form an application-layer package acknowledgement mechanism, and how that
569
-
mechanism works.
570
-
571
710
polyproto implements an application-level guaranteed delivery mechanism. This ensures that all gateway
572
711
messages sent from a home server to a client are received by the client in the order they were sent
573
712
in – especially when network conditions are suboptimal. This mechanism is based on the use of
@@ -584,9 +723,16 @@ in – especially when network conditions are suboptimal. This mechanism is base
584
723
retransmitted, preserving the integrity and completeness of communication between the client
585
724
and server.
586
725
726
+
The [heartbeat payload](#3238-heartbeat-and-heartbeat-ack-events) defines a payload parameter `except`.
727
+
728
+
If `except` was present and contained entries in the heartbeat payload sent by a client, the server
729
+
must re-send these events in the `d` part of the heartbeat ACK response. How this `d` payload is to be
730
+
formatted is also defined in [section 3.2.3.8](#3238-heartbeat-and-heartbeat-ack-events).
587
731
732
+
The server must prioritize sending these "missed" events over other events. The server should expect
733
+
that a client requests these events yet another time.
588
734
589
-
#### 3.3 Events over REST
735
+
#### 3.3 Events over events
590
736
591
737
For some implementation contexts, a constant WebSocket connection might not be wanted. A client can
592
738
instead opt to query an API endpoint to receive events, which would normally be sent through the WebSocket
@@ -649,7 +795,8 @@ TODO
649
795
650
796
!!! bug "TODO; Here's a TL;DR:"
651
797
652
-
- zstd level 5-13 recommended
798
+
- zstd level 5-13 recommended for realtime
799
+
- higher zstd levels recommended for events such as resumed etc.
653
800
- zstd must be offered on gateway server
654
801
- zstd must be offered on http api
655
802
- uncompressed available (but why would you do that)
0 commit comments