WuKongIM Docs

Packet Types

Reference WKProto FrameType values, directions, core fields, and current publication scope.

FrameType occupies the high four bits of the fixed header. UNKNOWN=0 is reserved and must not be sent. Enum presence does not mean the product Gateway supports that packet.

WKProto FrameType values, directions, and publication scope
Value / nameDirectionScopeMeaning
0 · UNKNOWNReservedWire-reserved; do not send; it never reaches product handling.
1 · CONNECTClient → ServerPublic coreMust be the sole first packet on a connection.
2 · CONNACKServer → ClientPublic coreReturns connection result and session material; v4+ requests also receive the negotiated version.
3 · SENDClient → ServerPublic coreSubmits one Channel message.
4 · SENDACKServer → ClientPublic coreCorrelates a SEND with its protocol result.
5 · RECVServer → ClientPublic coreDelivers one message to the current Session.
6 · RECVACKClient → ServerPublic coreAcknowledges client handling of a specific RECV.
7 · PINGClient → ServerPublic coreRefreshes inbound activity and requests PONG.
8 · PONGServer → ClientPublic coreBodyless response to PING.
9 · DISCONNECTClient ↔ ServerCodec onlyBidirectional codec contract; the current product Gateway publishes neither client ingress nor server emission.
10 · SUBClient → ServerCodec onlyCodec exists; current product Gateway ingress does not support it.
11 · SUBACKServer → ClientCodec onlyCodec response for SUB; current product entry is unpublished.
12 · EVENTClient ↔ ServerReservedThe current product Gateway uses it only for benchmark terminal-fence request and acknowledgement; it is not an application event API.

Core fields

PacketBody fields
CONNECTversion, client_key, device_id, device_flag, millisecond timestamp, uid, token
CONNACKnegotiated version for v4+ requests, server_key, salt, time difference, Reason Code, v4+ node_id
SENDSetting, 32-bit wire client_seq, client_msg_no, Channel, v3+ expire, msg_key, optional Topic, Payload
SENDACKmessage_id, client_seq, message_seq, Reason Code, optional client_msg_no
RECVSetting, msg_key, sender, Channel, v3+ expire, client_msg_no, message_id, message_seq, second timestamp, optional Topic, Payload
RECVACKmessage_id, message_seq
PING / PONGNo body; the complete packet is one fixed-header byte

Protocol v5 and earlier use a 32-bit message_seq; v6 uses 64 bits. The wire width of client_seq is always 32 bits. The current encoder limits SEND Payload to 32,767 bytes; the decoder rejects frames whose remaining length exceeds 1 MiB.

See Message Flags for fixed-header and Setting bits, Device Flags for device values, Channel Types for Channel values, and Reason Codes for outcomes.

Do not use unpublished packets

The current product Gateway accepts no ordinary inbound DISCONNECT, SUB, or arbitrary EVENT; EVENT is only for benchmark terminal-fence. UNKNOWN=0 never reaches product handling. Unknown numeric types, malformed frames, and decoded-but-unpublished packets fail closed through protocol-error, handler-error, or bounded-timeout paths.

On this page