Comparing version 1.1.1 to 1.1.2
21
index.js
const io = require("socket.io-client"); | ||
// const SConnect = require("./Services/socketConnect"); | ||
// Function to connect the socket | ||
function connectSocket(url) { | ||
@@ -17,2 +19,3 @@ const socket = io(url); | ||
// function to disconnect the socket | ||
function disconnectSocket(url) { | ||
@@ -30,5 +33,23 @@ const socket = io(url); | ||
// Function to emit the message from client | ||
// Taking the event name and data from client to emit socket | ||
async function emitContent(emitBody) { | ||
try { | ||
const status = await socket.emit("track", emitBody, (response) => { | ||
return "Emitted!"; | ||
}); | ||
if (status) { | ||
return status; | ||
} | ||
} catch (error) { | ||
return error; | ||
} | ||
} | ||
module.exports = { | ||
socketConnect: connectSocket, | ||
socketDisconnect: disconnectSocket, | ||
socketEmit: emitContent, | ||
}; |
@@ -6,3 +6,3 @@ { | ||
"name": "sockettwo", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"main": "index.js", | ||
@@ -9,0 +9,0 @@ "devDependencies": {}, |
1749
3
58