Skip to main content

Stream chat overview

Stream Chat APIs enable you to receive chat messages, chat requests, group invites, and notifications instantly, without the need for constant polling. Push Chat achieves this by the use of sockets.

Stream chat API

// Initialize stream to listen for events:
const stream = await userAlice.initStream(
[
CONSTANTS.STREAM.CHAT, // Listen for chat messages
CONSTANTS.STREAM.NOTIF, // Listen for notifications
CONSTANTS.STREAM.CONNECT, // Listen for connection events
CONSTANTS.STREAM.DISCONNECT, // Listen for disconnection events
],
{
// Filter options:
filter: {
// Listen to all channels and chats (default):
channels: ["*"],
chats: ["*"],

// Listen to specific channels and chats:
// channels: ['channel-id-1', 'channel-id-2'],
// chats: ['chat-id-1', 'chat-id-2'],

// Listen to events with a specific recipient:
// recipient: '0x...' (replace with recipient wallet address)
},
// Connection options:
connection: {
retries: 3, // Retry connection 3 times if it fails
},
raw: false, // Receive events in structured format
},
);

// Chat event listeners:

// Stream connection established:
stream.on(CONSTANTS.STREAM.CONNECT, async (a) => {
console.log("Stream Connected");

// Send initial message to PushAI Bot:
console.log("Sending message to PushAI Bot");

await userAlice.chat.send(pushAIWalletAddress, {
content: "Hello, from Alice",
type: "Text",
});

console.log("Message sent to PushAI Bot");
});

// Chat message received:
stream.on(CONSTANTS.STREAM.CHAT, (message) => {
console.log("Encrypted Message Received");
console.log(message); // Log the message payload
});

// Chat operation received:
stream.on(CONSTANTS.STREAM.CHAT_OPS, (data) => {
console.log("Chat operation received.");
console.log(data); // Log the chat operation data
});

// Connect the stream:
await stream.connect(); // Establish the connection after setting up listeners

// Stream disconnection:
stream.on(CONSTANTS.STREAM.DISCONNECT, () => {
console.log("Stream Disconnected");
});

// Stream Chat also supports other products like CONSTANTS.STREAM.NOTIF.
// For more information, please refer to push.org/docs/notifications.

Stream chat parameters

ParamTypeSub-TypeDefaultRemarks
listenconstant--Choose from various streams: CONSTANTS.STREAM.CHAT, CONSTANTS.STREAM.CHAT_OPS, CONSTANTS.STREAM.NOTIF, CONSTANTS.STREAM.CONNECT, CONSTANTS.STREAM.DISCONNECT
optionsPushStreamInitializeProps--Optional configuration properties for initializing the stream.
-options.filterobject-Configure to listen to specific chats or notifications.
-options.filter.channelsarray of strings['*']Pass list of channels over here to only listen to notifications coming from them.
-options.filter.chatsarray of strings['*']Pass list of chatids over here to only listen to chats coming from them.
-options.connectionobject-Option to configure the connection settings of the stream
-options.connection.retriesnumber3Number of automatic retries incase of error
-options.rawbooleanfalseIf enabled, respond with metadata useful in verifying the integrity of incoming chats or notifications among other things.

Note: Parameters in this style are mandatory.

Stream chat listen events

Listen eventsWhen is it triggered?
CONSTANTS.STREAM.CHATWhenever a chat is received.
CONSTANTS.STREAM.CHAT_OPSWhenever a chat operation is received.
CONSTANTS.STREAM.CONNECTWhenever the stream establishes connection.
CONSTANTS.STREAM.DISCONNECTWhenever the stream gets disconnected.
Expected response (CONSTANTS.STREAM.CHAT - Chat Request Stream)
{
"event": "chat.request",
"origin": "other",
"timestamp": "1696576961629",
"chatId": "b6f53ac38d0698ea64e6c4b0f024437ac2271ca869413d5f779d7cda75de1aaa",
"from": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05",
"to": [
"eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899"
],
"message": {
"type": "Text",
"content": "Hey There!!!"
},
"meta": {
"group": false
},
"reference": "bafyreid7b7m5ub3ouybgp2nzu733vle73bem5jcz5lg5u2epknncfhfeuy",
"raw": {
"fromCAIP10": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05",
"toCAIP10": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899",
"fromDID": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05",
"toDID": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899",
"encType": "pgp",
"encryptedSecret": "-----BEGIN PGP MESSAGE-----\n\nwcBMAyaG8qwtJd4vAQf+JbzXYRQZ4Tm+8P+igfgH5kHFxMdd6XD11+UgyX3o\nhvxIaH43AjtpAuhNCvVVnmmIjWH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qtsqUjsgVr+bsqSVhwD8hcjS4AlRmHgBCLdwMWSOnK\nqFFV/0X/SZXnq0Jy2NULGFGTuQSV6NhB448HMEToxGrVbkYhPxRazBbEaSxD\nDrYQ+8b6EQBSJlPCKO3MAV8CNMNbfwwGo1RtXm6+xZj3DCHEdiU96w==\n=BRdW\n-----END PGP SIGNATURE-----\n",
"sigType": "pgpv2",
"verificationProof": "pgpv2:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XBCRCfItQMnVG/eBYhBKTq6JYHJG7fZv5Yop8i1Ayd\nUb94AAClEggAxIFP9BJNwHzqUlEB8UD7gK+wNJxx5Nc7b31y0edUiSL6MWGL\n/b82efqACFNi2yc8/3xreJZr5ZuyHHSuCAb6zRamBS4QYTD+cMhNwpUTPiQE\ngyGZejVP8o+ko4N//itioi43BC619iSs7OTCvXkWS+gLFvOeRrBBPfp/15NG\nbeTavruBfiIUBR3YGtlcY296LLmo2YCEz49B1q/nQ+Ant1UNdhmuVhqU6W5l\nBzV3mLkxnlxpey9JNnNjC6tiKDB34OI06aYc863mLphk0R3obzGyt3XQqgL2\noteUPdkfPsJb3DCdq9F/XRNNJtypnAWeuMk8T5OK44FfLnjo26lwHQ==\n=QPQd\n-----END PGP SIGNATURE-----\n",
"previousReference": null
}
}
Expected response (CONSTANTS.STREAM.CHAT - Chat accept stream)
{
"event": "chat.accept",
"origin": "self",
"timestamp": "1696576962016",
"chatId": "b6f53ac38d0698ea64e6c4b0f024437ac2271ca869413d5f779d7cda75de1aaa",
"from": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899",
"to": [
"eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05"
],
"message": {
"type": null,
"content": null
},
"meta": {
"group": false
},
"reference": null,
"raw": {
"fromCAIP10": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899",
"toCAIP10": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05",
"fromDID": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899",
"toDID": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05",
"encType": "",
"encryptedSecret": null,
"signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XBCRAMkuwWk00HQxYhBKHMQtCl0iVWLJla7QyS7BaT\nTQdDAAAE+Af/U8h9c2tBPq6PjvDvjjs+yL/qTadagegzLZN0Gd9pT1kAmZ50\n+J1+f05oLCFdFcVTFz8dFZpueh+0s/8daXJ1uKVTBPPpfvWRInkD2KxlRrMu\n6gry3Tr2Fb1k8nIulIB/GSs7A85jJZQaG5WShZmfvg03bMadNIYmgl3ACmEe\nX3VovLFM5VLzuzKJGTn+7OM1VrZlZdsMRa7nfIdMKafMEEJcr41bmXCeYfzN\nw24kEO9/tAGaHzSRLsoNYxYDjby45OU1AJUHaLwjInk0klugcw7GWfMM3r2u\nE8qDuDZ0eveI6yArosK9amBlGF26l4UhEVPbCpumMrBBoItU03MPRw==\n=InOB\n-----END PGP SIGNATURE-----\n",
"sigType": "pgp",
"verificationProof": "pgp-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XBCRAMkuwWk00HQxYhBKHMQtCl0iVWLJla7QyS7BaT\nTQdDAAAE+Af/U8h9c2tBPq6PjvDvjjs+yL/qTadagegzLZN0Gd9pT1kAmZ50\n+J1+f05oLCFdFcVTFz8dFZpueh+0s/8daXJ1uKVTBPPpfvWRInkD2KxlRrMu\n6gry3Tr2Fb1k8nIulIB/GSs7A85jJZQaG5WShZmfvg03bMadNIYmgl3ACmEe\nX3VovLFM5VLzuzKJGTn+7OM1VrZlZdsMRa7nfIdMKafMEEJcr41bmXCeYfzN\nw24kEO9/tAGaHzSRLsoNYxYDjby45OU1AJUHaLwjInk0klugcw7GWfMM3r2u\nE8qDuDZ0eveI6yArosK9amBlGF26l4UhEVPbCpumMrBBoItU03MPRw==\n=InOB\n-----END PGP SIGNATURE-----\n",
"previousReference": null
}
}
Expected response (CONSTANTS.STREAM.CHAT - Chat message stream)
{
"event": "chat.message",
"origin": "other",
"timestamp": "1696576962232",
"chatId": "b6f53ac38d0698ea64e6c4b0f024437ac2271ca869413d5f779d7cda75de1aaa",
"from": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05",
"to": [
"eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899"
],
"message": {
"type": "Text",
"content": "Hey There!!!"
},
"meta": {
"group": false
},
"reference": "bafyreich6wtnzojmgqft6eudx43y4xir2emfnhxqlvyy7rq6a73w7szywe",
"raw": {
"fromCAIP10": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05",
"toCAIP10": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899",
"fromDID": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05",
"toDID": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899",
"encType": "pgp",
"encryptedSecret": "-----BEGIN PGP MESSAGE-----\n\nwcBMAyaG8qwtJd4vAQf9Fg4udBKFN/Pqd9+bi5dqGnLr/PJbRHaIljRlzt5R\nm+6sPUeGyVkXcFdGbSnUKG0M7rtwKVOg0LiCX/oFx//k6ULJWJNVpuZsy4QT\nGYZevcU6dEPMMw4KSG/KJb+sdTAqlRPegibfrfg7YK/Mr9xd0DbN8K9CFsqC\nW/CYz0AkgZS/wN2099cy9WEgesv9yHMd1tU+59A/gAjmI5qk1ge3PvReKGP/\ncSWCX4wz0lioviib7g9zdw79ecpJThmWXKWaW/dPikcNYUTCbK31gY9TuRsy\nS+z+7AdddGj0hqgQvZIfj4XHgHbpQrRisddbgc1AE1xV7eiiT2jtNPswtsat\n48HATAOhR72eaWLr8wEIAJ06+SdpAuQT6mdlIAo/Kttiyd71UkxgMlappQKQ\nM5e2aei/H/C93EFYIitVHobeH/Q8Y89k4E+Plopo23OS6TGGbWIUl0PSJkyg\nxAIyC8J4RfqylCp+k/d9ZxZP/l0WrrXo9SqGOfXnAVm/IITLl8hlG7dvSztI\ng8ndUrk8Af3Jwq4vbrbUOMr2ophzV027HVWQl53Dez/e+DfpuyvT2uDAevTw\nf82H0+2DIz3jzj3rNfkvyA6C3InhW37K4JNh+T3XlL7qWV77XTWFN0yLzZwP\nrW0hLWV5YGAj0kqpup5oY4H1ANPknRiNxP6hUrQH5ZkHPahEUo78gpP70qgc\nZafSQAHfRbVWZC7J+0OF15W+dR3iM8Ngrz/PjYEchVo73a8uBtNk4mSai8o7\nv1A2hx74RVX6yN05D8Bxpf6u7wQMXB8=\n=T81R\n-----END PGP MESSAGE-----\n",
"signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XCCRCfItQMnVG/eBYhBKTq6JYHJG7fZv5Yop8i1Ayd\nUb94AAB/NQf/bwUkzVHV6/ODTtnjeA0y0kqEv3OAzbYoG60QdgNf3zAEmFbk\nf4ULNghzvl3Nt3S7TYsF06xu4gzzsjaOt8glPxJCiZUa3lXdJH53X5+VCbZV\nSWJuip9tdljAv4zg27+ZAGrwyC4NrTHE8t1b8mDHLTgJeqae6dJHjScmCXKZ\ngBZb2mNeVYWklg1mpCuXxB8YJpeFKDgSYeZ3C+YNSGAmoCyICRpYvxYo038P\nDehkFMS3HHvSGjFslcDN0D9l8gWY/4H520Rfer4GHJoFMSZeKlyWkQRCNPNz\nFY3fjmPLuimbEnnzd9Nxw1kbx4P9SBEEa4xhEjJnxx/sAnQxJX72RQ==\n=1zuZ\n-----END PGP SIGNATURE-----\n",
"sigType": "pgpv2",
"verificationProof": "pgpv2:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XCCRCfItQMnVG/eBYhBKTq6JYHJG7fZv5Yop8i1Ayd\nUb94AACE2wf9GQq+/lkGQ7HVVmLF3SnSRI0IM9s4OvLckwjyd1i3D1lLnwu5\nVaPj+VxKZSBe+GHHukd/gQ+qYr9fhfHNMQ019AfHfz81kCCai6KhExH3YVbE\nsrL+j2bwttfcRjRWy/MoHo1T6M9F8PR4jm4aaktTSliApRE0k92Igm8Gw5it\nUaP1/qDIOQRjlofa7wAyDz7Kf83/WkbS78+MJZP0JWL9znhdFH5em8RvVYpS\nMa7/Skl8BnCr46BIfcd4Urd9q/RECKA4WJaxpOosH42MJQ4DLJ2iRnzZKkyr\nyZBfXXyiMA5goy+uzJzVhA5tlsHZp3jUFEZSvofaMX6a5UopweHMGw==\n=Wp+E\n-----END PGP SIGNATURE-----\n",
"previousReference": "bafyreid7b7m5ub3ouybgp2nzu733vle73bem5jcz5lg5u2epknncfhfeuy"
}
}
Expected response (CONSTANTS.STREAM.CHAT - Chat rejection stream)
{
"event": "chat.reject",
"origin": "self",
"timestamp": "1696577053528",
"chatId": "e819ff24ee06d44927bdc0c0967bd55b6410d389c29c72c329dcce4dca9f413d",
"from": "eip155:0xd49F5038C4baA79DF1f1191d6B18FF55D06a4648",
"to": [
"eip155:0x1fd48A2697Bdfd5A63436cEf5548e095649B65a7"
],
"message": {
"type": null,
"content": null
},
"meta": {
"group": false
},
"reference": null,
"raw": {
"fromCAIP10": "eip155:0xd49F5038C4baA79DF1f1191d6B18FF55D06a4648",
"toCAIP10": "eip155:0x1fd48A2697Bdfd5A63436cEf5548e095649B65a7",
"fromDID": "eip155:0xd49F5038C4baA79DF1f1191d6B18FF55D06a4648",
"toDID": "eip155:0x1fd48A2697Bdfd5A63436cEf5548e095649B65a7",
"encType": "",
"encryptedSecret": null,
"signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7YdCRCAVGEKwfvuDBYhBDuMv0sczhcV+XqGZYBUYQrB\n++4MAACNGQf/UM17dLBNzMLEmhfThqnxdXo1w1n4U/1DCSmzavvJ2CmCXvTU\nfekuTaxEEGQ83yKeI85KEkHdKgYpNmNa7O5OfOekjum4kRLi8qo4yVH6uard\nEiV+r4i52gWAqdrZOuFqWOLpbtWzMXF3gl6f+Sq5VT/SIi2/g5lO/bYd4QFX\n7cm/J+M5MzDJvxDht29bwDMylJVJXYr93xsEsLUAG0xo71mzsnEc7aSCxY71\nGw+4/KstoSDT40pvoZLw7qRidmHOt5QLHI6wpcztdo8ALDByYpIifV/J7lao\ns4bDS0TOXCb8/F6MQt2SXRKD8pIvzQ3CZBBZSKg+29Muq7Gw8hDq/A==\n=lcfd\n-----END PGP SIGNATURE-----\n",
"sigType": "pgp",
"verificationProof": "pgp-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7YdCRCAVGEKwfvuDBYhBDuMv0sczhcV+XqGZYBUYQrB\n++4MAACNGQf/UM17dLBNzMLEmhfThqnxdXo1w1n4U/1DCSmzavvJ2CmCXvTU\nfekuTaxEEGQ83yKeI85KEkHdKgYpNmNa7O5OfOekjum4kRLi8qo4yVH6uard\nEiV+r4i52gWAqdrZOuFqWOLpbtWzMXF3gl6f+Sq5VT/SIi2/g5lO/bYd4QFX\n7cm/J+M5MzDJvxDht29bwDMylJVJXYr93xsEsLUAG0xo71mzsnEc7aSCxY71\nGw+4/KstoSDT40pvoZLw7qRidmHOt5QLHI6wpcztdo8ALDByYpIifV/J7lao\ns4bDS0TOXCb8/F6MQt2SXRKD8pIvzQ3CZBBZSKg+29Muq7Gw8hDq/A==\n=lcfd\n-----END PGP SIGNATURE-----\n",
"previousReference": null
}
}
Expected response (CONSTANTS.STREAM.CHAT - Group chat message stream)
{
"event": "chat.message",
"origin": "self",
"timestamp": "1696576220066",
"chatId": "a64abd4256a607e7bd2ab4068d9024ddb0d355687267c0e39eb31a3a7d245ab0",
"from": "eip155:0x9d57759F2D0cbf19D6cfAf72C5A4c4B1A2443500",
"to": [
"a64abd4256a607e7bd2ab4068d9024ddb0d355687267c0e39eb31a3a7d245ab0"
],
"message": {
"type": "Text",
"content": "Hello"
},
"meta": {
"group": true
},
"reference": "bafyreidheq2764lxdi2plbp4mik24ohtjfyvfbmkde2wsb2ahvwdjrwygq",
"raw": {
"fromCAIP10": "eip155:0x9d57759F2D0cbf19D6cfAf72C5A4c4B1A2443500",
"toCAIP10": "a64abd4256a607e7bd2ab4068d9024ddb0d355687267c0e39eb31a3a7d245ab0",
"fromDID": "eip155:0x9d57759F2D0cbf19D6cfAf72C5A4c4B1A2443500",
"toDID": "a64abd4256a607e7bd2ab4068d9024ddb0d355687267c0e39eb31a3a7d245ab0",
"encType": "PlainText",
"encryptedSecret": "",
"signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7LcCRBG3kV4UbDyWhYhBPyPo+yD4wbsNV5YNkbeRXhR\nsPJaAABWfAf+MQFE/qy3X8R19wQeQ90eu6rYtK1h5aVlLwezo4z8F/8KqK1S\nwr8tlrtlQ9TieNH6Q5xebM2K356R44QnmE3qZB52Ukww2hiyrrCu7+x55KzK\na1+P8bQh1bGiesBYOa3LqnFlnFyQgBFJvGQqI0m2QBDbkM5OTkQGUYSi4tnO\nYIxVplb/lhEYHt/ZRGu1xg0XMhgycsRESidNLldKRx+AooeGfWgNIws97Yaq\nBbGTEgNOul8XV8b7y2ORL74Dl18UMPRF91dyktm/y8FJp30rWHaeNMAgKzlX\nr/nSgXFtCkfxclQgbBlSit1PBHmhB/Sr0amZKelpiYdRT+lVluknLg==\n=/QXX\n-----END PGP SIGNATURE-----\n",
"sigType": "pgpv2",
"verificationProof": "pgpv2:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7LcCRBG3kV4UbDyWhYhBPyPo+yD4wbsNV5YNkbeRXhR\nsPJaAAAHQQf/eb4aaRUTbcAwLRWlI+55Ddd1PBeWXhTyDIZgsiFYUwSmtLLd\n/bFHnQzyplo+Tp8BuUB+wO5dH112ousWxOeTj8yAGUve6OhbP/8g9nJmHecJ\nmZwAHPhr4BVYomQRQChLp8FstLLjiI3CNdfarIYzBmlWGhrurXltjx69e+Ef\nyxtxRZ6zZavG56IHhOJru0p3y1nsbNI5eGsXG9Wq3FdAUXhbsOizxDCAdqN/\nfzOmqnZGMKsk6DNQ1471txAGujbg29i9o41lxYGcuNYYMal0CEceawfMXDH8\n8T2fbILXRZzpX/I+dlArPMDHqLdfNu2uLwYOmq+aTv7qUm3t1SkR0w==\n=+0T5\n-----END PGP SIGNATURE-----\n",
"previousReference": null
}
}
Expected response (CONSTANTS.STREAM.CHAT - Group chat request stream)
{
"origin": "self",
"timestamp": 1696576021653,
"chatId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900",
"from": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12",
"to": [
"eip155:0x3AD7cf4Ef82dd7f4f040c5eD7352f12C662F21db",
"eip155:0x1b77273e527Ec5948995f395e3ADa41E708d617e",
"eip155:0x7711FED1Bc6B1E461aE7869959bdBf529335db5A"
],
"event": "chat.request",
"meta": {
"group": true
},
"raw": {
"verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IVCRAxpSc3atCeoBYhBGHp9Ifk8vvLrMzkYTGlJzdq\n0J6gAAD//wf/bTrC0LnwzcUIE10d3XQ2Y56jK6kRVGWKR/7i6CC+hGs5PGKu\nzefIGdtLVjAqTeKn6PbNnb1t2niLhmMeTbN+knGCzSqx/FN8OodLLmunLNAx\nWJ5thFyjZWNyIF7IoH2zUdc8zbsjXHzfd70yoxMZSwd5C7EPj/e17kyYHdj2\nzPQecbTsnCIjJKzi0PBa2YMNoF5fExP3hwTnP0k693r8oC5ivxj7Ht3Hwmu0\njsv+sGXk+XZPC/JQQfEEviEh3j9dEiNIeHutk/7cFdEnDfEy5dFMxubjf6oH\nY6vt0q2V2CZJHHw99JYeTHN/d3YDXc4RggoUINo1cysR904owgEsVw==\n=QTX8\n-----END PGP SIGNATURE-----\n:0x136E326b22ED48dbB665733eC024407d4fAA4F12"
}
}
Expected response (CONSTANTS.STREAM.CHAT - Group chat request accepted stream)
{
"event": "chat.accept",
"origin": "other",
"timestamp": "1696576021843",
"chatId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900",
"from": "eip155:0x3AD7cf4Ef82dd7f4f040c5eD7352f12C662F21db",
"to": null,
"message": {
"type": null,
"content": null
},
"meta": {
"group": true
},
"reference": null,
"raw": {
"fromCAIP10": "eip155:0x3AD7cf4Ef82dd7f4f040c5eD7352f12C662F21db",
"toCAIP10": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900",
"fromDID": "eip155:0x3AD7cf4Ef82dd7f4f040c5eD7352f12C662F21db",
"toDID": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900",
"encType": "",
"encryptedSecret": null,
"signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IVCRA1c2iyC1q/7RYhBH5kgFyUQlfGEgbg0jVzaLIL\nWr/tAABinQf9E+7UUlPnAVu9VifNHS6GJuf/o1RJdE8gL4mi27+rdfr+Y2+Y\nzZaZbBEJK3BTJgT4op1yJKtg2GZDZUIMWSbkcouE+2YyyYsANS89z/blq/05\nYf6RFuUeHr3pGIyzkeb7Aj7VEHbUhrK5nHheTkO7K6Gpa9blNEYVrhsYrHbs\n7UhYKlq6tsoo1E8XXFWBhd+2rVPKF4zhIt9jPdqNPYTQSn7K7hjVvZueWd0Z\nD7Vr4RO4Af3a/5EiVAvOtxVGLpwhw+FKDOGJhRdNCNLqEc8gZ0q+l1cvglKp\nfAiqSZpnnTzIUloszJvNFAeQSR/nZQ9wjEihosDztVOOz5uyQ3XhZw==\n=kX/p\n-----END PGP SIGNATURE-----\n",
"sigType": "pgp",
"verificationProof": "pgp-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IVCRA1c2iyC1q/7RYhBH5kgFyUQlfGEgbg0jVzaLIL\nWr/tAABinQf9E+7UUlPnAVu9VifNHS6GJuf/o1RJdE8gL4mi27+rdfr+Y2+Y\nzZaZbBEJK3BTJgT4op1yJKtg2GZDZUIMWSbkcouE+2YyyYsANS89z/blq/05\nYf6RFuUeHr3pGIyzkeb7Aj7VEHbUhrK5nHheTkO7K6Gpa9blNEYVrhsYrHbs\n7UhYKlq6tsoo1E8XXFWBhd+2rVPKF4zhIt9jPdqNPYTQSn7K7hjVvZueWd0Z\nD7Vr4RO4Af3a/5EiVAvOtxVGLpwhw+FKDOGJhRdNCNLqEc8gZ0q+l1cvglKp\nfAiqSZpnnTzIUloszJvNFAeQSR/nZQ9wjEihosDztVOOz5uyQ3XhZw==\n=kX/p\n-----END PGP SIGNATURE-----\n",
"previousReference": null
}
}
Expected response (CONSTANTS.STREAM.CHAT - Group chat request rejected stream)
{
"event": "chat.reject",
"origin": "other",
"timestamp": "1696576601599",
"chatId": "7a200d55cc76428e9938e935b604e993c5f6cb2f3e9a1dd7108a07dd32de0791",
"from": "eip155:0x15d8a67c0B1eb61dA5901109DB4CA382E989aA13",
"to": null,
"message": {
"type": null,
"content": null
},
"meta": {
"group": true
},
"reference": null,
"raw": {
"fromCAIP10": "eip155:0x15d8a67c0B1eb61dA5901109DB4CA382E989aA13",
"toCAIP10": "7a200d55cc76428e9938e935b604e993c5f6cb2f3e9a1dd7108a07dd32de0791",
"fromDID": "eip155:0x15d8a67c0B1eb61dA5901109DB4CA382E989aA13",
"toDID": "7a200d55cc76428e9938e935b604e993c5f6cb2f3e9a1dd7108a07dd32de0791",
"encType": "",
"encryptedSecret": null,
"signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7RZCRA8vrXKPfPlwRYhBECQe8HJcpH3IRX27jy+tco9\n8+XBAADl0Af7BumEnrIcSj/1H3LvxaqG4wK/G6iTP3iTvXUca0n7UBplXS8P\nbKV7XFhjollN6jJVZ53mmUHgNDAbfaQTvutm3SRJlFVJxV4zV9uL7UMZW+k4\nYAJM5XNbqqyn7+KjcLIwBpJ3YLMmmLfdrO4+WJAYswAAJGiS+KPDsU+oOsfm\nHMWc5aRqis0Epf3FLWELO0uDyydm75575bBe60FxfPjnd5GhUgmMWydNCZH1\ngeGMLZbhuQ+bvnLjTuWSmnW64cl+jlRCzs2Mpgwvrh0ZQIcPWjVDjNevNohu\n3l9VXhHuYPUCyGGIyhcPG3tubRcudY+U/uavhQ6XXgWPVdKZ/qwfAw==\n=0jOy\n-----END PGP SIGNATURE-----\n",
"sigType": "pgp",
"verificationProof": "pgp-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7RZCRA8vrXKPfPlwRYhBECQe8HJcpH3IRX27jy+tco9\n8+XBAADl0Af7BumEnrIcSj/1H3LvxaqG4wK/G6iTP3iTvXUca0n7UBplXS8P\nbKV7XFhjollN6jJVZ53mmUHgNDAbfaQTvutm3SRJlFVJxV4zV9uL7UMZW+k4\nYAJM5XNbqqyn7+KjcLIwBpJ3YLMmmLfdrO4+WJAYswAAJGiS+KPDsU+oOsfm\nHMWc5aRqis0Epf3FLWELO0uDyydm75575bBe60FxfPjnd5GhUgmMWydNCZH1\ngeGMLZbhuQ+bvnLjTuWSmnW64cl+jlRCzs2Mpgwvrh0ZQIcPWjVDjNevNohu\n3l9VXhHuYPUCyGGIyhcPG3tubRcudY+U/uavhQ6XXgWPVdKZ/qwfAw==\n=0jOy\n-----END PGP SIGNATURE-----\n",
"previousReference": null
}
}
Expected response (CONSTANTS.STREAM.CHAT - Participant removed from group stream)
{
"event": "chat.group.participant.remove",
"origin": "other",
"timestamp": 1696576219688,
"chatId": "a64abd4256a607e7bd2ab4068d9024ddb0d355687267c0e39eb31a3a7d245ab0",
"from": "eip155:0x50bbFA4833e89389FE00a62D14E6eDDf1c155855",
"to": [
"eip155:0x50bbFA4833e89389FE00a62D14E6eDDf1c155855"
],
"raw": {
"verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7LbCRByYd40HdgiDBYhBLSq7nZZRBYzsnezMXJh3jQd\n2CIMAADNoAf/UxniQM/ZtzDuSmhIuvWiuGzl8vkeFbN2dOLW1a2yJO2Z8jDa\nDDuxyTcSt9d9YyCO/NojhbxmScE73gBysVt9OLdUn9hXlAKclYjXu4r7KvLk\nmrQyMlN3akDjpzH1gGiiCSi18vll07KRGSgWt3P13cA9vGpT+YV3A6uiCGUS\nE3CV16wdYTd0FUPJHckTJVVu3se1K3NfzzELMwIeN9bPJLxaZD3u3t074dN/\nc+jwUS1OC0sUQ5ptHCgfNIMgtueutKSPPZO6MKVBE/qQauKh81PHgzrhW0OE\n6gMkSDPjVbncjBSumofTWga7udk65RhwysCxx9qa3O/u6skBH0N+bg==\n=oqeR\n-----END PGP SIGNATURE-----\n:0x50bbFA4833e89389FE00a62D14E6eDDf1c155855"
}
}
Expected response (CONSTANTS.STREAM.CHAT - Participant joins a group stream)
{
"event": "chat.group.participant.join",
"origin": "other",
"timestamp": 1696576531987,
"chatId": "1032596dea9f24a7a0ee419668f7d39da32a2fb32003a27c6b293cc6668d2a82",
"from": "eip155:0x8c1EAB3227250526f133681630c2B191969f8581",
"to": null,
"raw": {
"verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7QTCRCI26TZ8c3OJBYhBNDtmDIWimjDn9MUIIjbpNnx\nzc4kAAAfFwgAgQkKBS/W7e53maVOne1lob2Qk14gWfUQm/LaRlP0iO5YwPlg\njckyQaX0Ient3PmLSqUoykuKWH2wR53YJ6Wgb//EkOxdywkrDbAZCGnQgxaO\nakTU30mDaV06HLQjDQmRTHdeozwV+6PF+i71vZPNmsCSI8x/VSex/gMrs2nk\nhSAHnuhUcuEWHshc+FXEO70acz8nkhH7Pw0icDwb50yFZNuekrK4rjUPmXb2\nwBzwFDjpfS6n8JMQz4//jYXyFuDfzYlr97ymWdltR5h8QKs1iZsN++X/5FsA\nO2EltMRqhxcpPApcHB9QQe6CAZFG+1fB8FKOXx6MZMwHqjyEtrL27Q==\n=bDP5\n-----END PGP SIGNATURE-----\n:0x8c1EAB3227250526f133681630c2B191969f8581"
}
}
Expected response (CONSTANTS.STREAM.CHAT - Participant leaves a group stream)
{
"event": "chat.group.participant.leave",
"origin": "other",
"timestamp": 1696576531987,
"chatId": "1032596dea9f24a7a0ee419668f7d39da32a2fb32003a27c6b293cc6668d2a82",
"from": "eip155:0x8c1EAB3227250526f133681630c2B191969f8581",
"to": null,
"raw": {
"verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7QTCRCI26TZ8c3OJBYhBNDtmDIWimjDn9MUIIjbpNnx\nzc4kAAAfFwgAgQkKBS/W7e53maVOne1lob2Qk14gWfUQm/LaRlP0iO5YwPlg\njckyQaX0Ient3PmLSqUoykuKWH2wR53YJ6Wgb//EkOxdywkrDbAZCGnQgxaO\nakTU30mDaV06HLQjDQmRTHdeozwV+6PF+i71vZPNmsCSI8x/VSex/gMrs2nk\nhSAHnuhUcuEWHshc+FXEO70acz8nkhH7Pw0icDwb50yFZNuekrK4rjUPmXb2\nwBzwFDjpfS6n8JMQz4//jYXyFuDfzYlr97ymWdltR5h8QKs1iZsN++X/5FsA\nO2EltMRqhxcpPApcHB9QQe6CAZFG+1fB8FKOXx6MZMwHqjyEtrL27Q==\n=bDP5\n-----END PGP SIGNATURE-----\n:0x8c1EAB3227250526f133681630c2B191969f8581"
}
}
Expected response (CONSTANTS.STREAM.CHAT_OPS - Group created stream)
{
"event": "chat.group.create",
"origin": "self",
"timestamp": 1696576020848,
"chatId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900",
"from": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12",
"meta": {
"name": "test",
"description": "test",
"image": "test",
"owner": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12",
"members": [],
"admins": [
{
"address": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12",
"profile": {
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA30lEQVR4AcXBsa2DMBSG0S+/3LJBKkZgjUzADi4sJEoqSkvIBSNEYhtG8BIMkNdeGqd4iu45j+f79aHh7HasY91o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ksAVKK4yHqy4aQe\nqXPBjBMmUBUuSlB/8KwI6FtX2JFm9s7ATQRlH7ITAQgAySkQBm6drDe5FJI1\nUe5QhoUXX8ugfXyCR7SoL4JMxVmhaO9/Fj/Swy1UoagONZYJZzcamJWnPzAR\nvfYBEzSEFGrkPKVdrJAM7Zf1sX5v+wpUtLTE6/gSCzAJMnK11pdgTHqEn+Rc\nfPuTnGYFZw3EybYMbhr/wBCyvFd49ES+8q3jrjHbMGS5lFCnVFYE/gyN9nqp\nSG0biMS7pl+w51bjIfJ9bRiUzrxpk5yvr9WDqMTVJA0N6ZRsD+xtkipc7XFe\nnsY0caCVVYFOH9YCiwuytC4ShU2VHjEPXcgzLTk9k5ecfE8AdwiYgLsWOHTn\nbz1JpwqYJx5Rndkb4vXdV6Pi7wARAQABwsB2BBgBCAAqBQJlH7ITCRAxpSc3\natCeoAIbDBYhBGHp9Ifk8vvLrMzkYTGlJzdq0J6gAACZvQgAyJrLhQ9/MsBU\n6E1ZwdKlKBWi62A4SBXRZJpRl2hBwagyNq7zbsX/yO7D7fW1FVLfcT28cmCe\nCUD6aa904dQ8GVDyuUqRsSXZZvZqFdddgNT7O8fCbIbMCihfz9Gg6mbxVHcy\nOby7nkOBbrKDBpIPab9yMHHYsycsPDo8/8cGI9RNZz06aAgOVGjfcMTuw8RR\nXWINBmTWn9I4xrylEtH7SQU9b0Alj2SxfV9N/+mMGGv/Zo3E99/a/p2DLExY\n/+dk0I9kxjxHkjtq49/tT00JYLDkHVtMgGxjl9n8Uv7KXFHkuGFg7gV9ivdN\n1phi4oalkdY5sqbd5GkUxM7M1VN6Xg==\n=nCF5\n-----END PGP PUBLIC KEY BLOCK-----\n"
}
}
],
"pending": {
"members": [],
"admins": []
},
"private": false,
"rules": {}
},
"raw": {
"verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IUCRAxpSc3atCeoBYhBGHp9Ifk8vvLrMzkYTGlJzdq\n0J6gAADrLAgAgDSQ7CJ3ZVOPye++rkpyR4Q9XSGnV3Z0bqO+HCqFDW/hTmJ+\n12kjrAQV43Q1fQviIMqh+RTA9WJHPA14vu/ZYHjmCM/HfPSxbY4zV/7FJF9C\nCaEgq+wGs+2vhixHX4Zoo4qrxdXQ6q8Wl4XXW3SVaw1sGxfIh+uMje54Tsil\nnaLNK+lIPdSAJDw1hOHIM3iMWaSzZasLaXkJ6KY9KefW52mhg112BZI94FxJ\n/wFQtlIaXGZHhCbaqiigjRPKo17KyW7PX6I0rTAQJlwHyIKS/vIH8Uahi2x3\ndzjonpXjjtsgcP+VhzEP1jxQkpo4mG47Fxkxzp/Q7ztdSGHnJGlXkQ==\n=HydQ\n-----END PGP SIGNATURE-----\n"
}
}
Expected response (CONSTANTS.STREAM.CHAT_OPS - Group updated stream)
{
"event": "chat.group.update",
"origin": "self",
"timestamp": 1696576021192,
"chatId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900",
"from": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12",
"meta": {
"name": "test",
"description": "Updated Description",
"image": "test",
"owner": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12",
"members": [],
"admins": [
{
"address": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12",
"profile": {
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA30lEQVR4AcXBsa2DMBSG0S+/3LJBKkZgjUzADi4sJEoqSkvIBSNEYhtG8BIMkNdeGqd4iu45j+f79aHh7HasY91oGZcJa7giLcKZcCacBb441g1rXCZajnXjJtEknAlnwlk4u52WIUWsfEWaEjdnt9MinAlnwlk41g0rp4o1l57/GFLEmkuPJZwJZ8JZ4IucKr8knAlnwlnIqWLNpcfKqWKd3U7LcEWsufRYOVUs4Uw4E87CXHqscZmwRu6GK9Jydjs3C3frhiWcCWfC2eP5fn0w5tLzSzlVLOFMOBPO/gCOGzPC9wXXhQAAAABJRU5ErkJggg==",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49ES+8q3jrjHbMGS5lFCnVFYE/gyN9nqp\nSG0biMS7pl+w51bjIfJ9bRiUzrxpk5yvr9WDqMTVJA0N6ZRsD+xtkipc7XFe\nnsY0caCVVYFOH9YCiwuytC4ShU2VHjEPXcgzLTk9k5ecfE8AdwiYgLsWOHTn\nbz1JpwqYJx5Rndkb4vXdV6Pi7wARAQABwsB2BBgBCAAqBQJlH7ITCRAxpSc3\natCeoAIbDBYhBGHp9Ifk8vvLrMzkYTGlJzdq0J6gAACZvQgAyJrLhQ9/MsBU\n6E1ZwdKlKBWi62A4SBXRZJpRl2hBwagyNq7zbsX/yO7D7fW1FVLfcT28cmCe\nCUD6aa904dQ8GVDyuUqRsSXZZvZqFdddgNT7O8fCbIbMCihfz9Gg6mbxVHcy\nOby7nkOBbrKDBpIPab9yMHHYsycsPDo8/8cGI9RNZz06aAgOVGjfcMTuw8RR\nXWINBmTWn9I4xrylEtH7SQU9b0Alj2SxfV9N/+mMGGv/Zo3E99/a/p2DLExY\n/+dk0I9kxjxHkjtq49/tT00JYLDkHVtMgGxjl9n8Uv7KXFHkuGFg7gV9ivdN\n1phi4oalkdY5sqbd5GkUxM7M1VN6Xg==\n=nCF5\n-----END PGP PUBLIC KEY BLOCK-----\n"
}
}
],
"pending": {
"members": [],
"admins": []
},
"private": false,
"rules": {}
},
"raw": {
"verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IVCRAxpSc3atCeoBYhBGHp9Ifk8vvLrMzkYTGlJzdq\n0J6gAACfBQgAgDYEX8fSjArginDEbjDmMxQxmieIMt3/N2wTjWU/r8muAnNb\nIpijtAvftEkCoVnefXH9rlILr0rUGLwFXTsc6YYO6u9Tr1iODQQZopD8Bqtc\ntKE5RzRT6qS6QUQQP8YNlh/iqtTWCzdY7aYKGNWkrSOUKhu+iHKLIsEqNSf2\nYV9S9qksGWhK9xfsExkHjR0Df3yo/BUwpDKW/duiwBPgl99aUYunjAQyRRun\njlXmX6W+bEAlEmJABq5C9Tw+M/+j4AiBy57kdrxAQ6aKHnfGJafH7Xo8/BuN\nG6XJdNELJKug/5Xb+eWjO3JggGOD90fetTKcVdzGJPhXaVyIhL0e/A==\n=+sdF\n-----END PGP SIGNATURE-----\n:0x136E326b22ED48dbB665733eC024407d4fAA4F12"
}
}

Reinstate chat stream

To reinstate a chat stream. Useful when you want to listen to more events or change the filter options.

// say you created a stream like this, const stream = await userAlice.initStream( [ 'STREAM.NOTIF', 'STREAM.CONNECT', 'STREAM.DISCONNECT' ]);
// now you want to listen to more events or change the filter options
// then you can do that using this method

// await stream.reinit(listen, newOptions)
const newStream = await stream.reinit(
[
CONSTANTS.STREAM.CHAT, // Listen for chat messages
CONSTANTS.STREAM.CONNECT, // Listen for connection events
CONSTANTS.STREAM.DISCONNECT, // Listen for disconnection events
],
{
// Filter options:
filter: {
// Listen to all channels and chats (default):
channels: ["*"],
chats: ["*"],

// Listen to specific channels and chats:
// channels: ['channel-id-1', 'channel-id-2'],
// chats: ['chat-id-1', 'chat-id-2'],

// Listen to events with a specific recipient:
// recipient: '0x...' (replace with recipient wallet address)
},
// Connection options:
connection: {
retries: 3, // Retry connection 3 times if it fails
},
raw: false, // Receive events in structured format
},
);

Reinit Stream chat parameters

ParamTypeSub-TypeDefaultRemarks
listenconstant--Choose from various streams: CONSTANTS.STREAM.CHAT, CONSTANTS.STREAM.CHAT_OPS, CONSTANTS.STREAM.NOTIF, CONSTANTS.STREAM.CONNECT, CONSTANTS.STREAM.DISCONNECT
newOptionsPushStreamInitializeProps--Optional configuration properties for initializing the stream.
-newOptions.filterobject-Configure to listen to specific chats or notifications.
-newOptions.filter.channelsarray of strings['*']Pass list of channels over here to only listen to notifications coming from them.
-newOptions.filter.chatsarray of strings['*']Pass list of chatids over here to only listen to chats coming from them.
-newOptions.connectionobject-Option to configure the connection settings of the stream
-newOptions.connection.retriesnumber3Number of automatic retries incase of error
-newOptions.rawbooleanfalseIf enabled, respond with metadata useful in verifying the integrity of incoming chats or notifications among other things.

Note: Parameters in this style are mandatory.

Stream Info API

To get the info of the current stream.

// say you created a stream like above, const stream = await userAlice.initStream( [ 'STREAM.CHAT', 'STREAM.CONNECT', 'STREAM.DISCONNECT' ]);
// then you can get the info of the stream like this

// stream.info()
const streamInfo = await stream.info();
Expected response
{
options: { raw: false, connection: { auto: true, retries: 3 }, env: 'prod' },
listen: [ 'STREAM.CHAT', 'STREAM.CONNECT', 'STREAM.DISCONNECT' ]
}