Skip to content

Instantly share code, notes, and snippets.

@GoodnessEzeokafor
Created August 27, 2024 14:14
Show Gist options
  • Save GoodnessEzeokafor/1160a3275ae800c2e322c663d5fe2090 to your computer and use it in GitHub Desktop.
Save GoodnessEzeokafor/1160a3275ae800c2e322c663d5fe2090 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="https://cdn.socket.io/4.3.2/socket.io.min.js"
integrity="sha384-KAZ4DtjNhLChOB/hxXuKqhMLYvx3b5MlT55xPEiNmREKRzeEm+RVPlTnAn0ajQNs"
crossorigin="anonymous"></script>
<script>
const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Ijc3YTJhMzdhLTA2ZDMtNGUwZC05OTVlLWMyZDI0YTZhZGVjMSIsInR5cGUiOiJhdXRoIiwiaWF0IjoxNzIzMDYyMDgxLCJleHAiOjE3MjMxNDg0ODF9.F19lekTdIeumR8uVlQeuJdXjAL81Ye5G_FCWRyU335U"
const socket = io('http://localhost:2242', {
query: { token }
});
socket.emit('process.gateway.search.products.show.modal', { q: 'sneakers' }, (data) => console.log(data));
// join conversation
// socket.emit('process.join.conversation', {
// conversationId: 'sdsdsdfddsd',
// userId: "77a2a37a-06d3-4e0d-995e-c2d24a6adec1"
// }, (data) => console.log(data))
// socket.emit('process.join.conversation', {
// conversationId: '00b53199-ff37-4bc8-9419-16963e4a142c',
// userId: "cf41bdd3-b7ac-4f08-a149-a6ea85d93d0a"
// }, (data) => console.log(data))
// join conversation
socket.emit('process.join.conversation', {
conversationId: '00b53199-ff37-4bc8-9419-16963e4a142c',
userId: "26dc00c1-e05a-4a6d-ad51-7264b151b07d"
}, (data) => console.log(data))
// send message
socket.emit('process.send.message', {
conversationId: '00b53199-ff37-4bc8-9419-16963e4a142c',
userId: "26dc00c1-e05a-4a6d-ad51-7264b151b07d",
message: "your loss tho"
}, (data) => console.log(data))
// socket.emit('process.send.message', {
// conversationId: '00b53199-ff37-4bc8-9419-16963e4a142c',
// userId: "26dc00c1-e05a-4a6d-ad51-7264b151b07d",
// message: "please answer me +++"
// }, (data) => console.log(data))
// socket.emit('process.join.conversation', {
// conversationId: '00b53199-ff37-4bc8-9419-16963e4a142c',
// userId: "391e00f2-ac7b-435e-8632-20dd370c7f86"
// }, (data) => console.log(data))
// socket.emit('process.join.conversation', {
// conversationId: '00b53199-ff37-4bc8-9419-16963e4a142c',
// userId: "6ea46004-d538-4fbd-a392-8c48400fd5d4a"
// }, (data) => console.log(data))
// socket.emit('process.join.conversation', {
// conversationId: '00b53199-ff37-4bc8-9419-16963e4a142c',
// userId: "c46e8481-124c-4e1a-ab71-c283bcbfa3e5"
// }, (data) => console.log(data))
//listen to new messages
socket.on('process.new.message', (data) => console.log(data));
socket.on('disconnect', function () {
console.log('Disconnected');
});
</script>
</head>
<body></body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment