Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sockettwo

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sockettwo - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

40

index.js

@@ -11,21 +11,35 @@ // @ts-ignore

function connectSocket(url) {
socket = io(url);
// function connectSocket(url) {
// socket = io(url);
let currentRoute = null;
// let currentRoute = null;
if (typeof window !== "undefined") {
currentRoute = window.location.pathname;
}
// if (typeof window !== "undefined") {
// currentRoute = window.location.pathname;
// }
let IsConnected = false;
// let IsConnected = false;
socket.on("connect", () => {
socketId = socket.id;
IsConnected = true;
// socket.on("connect", () => {
// socketId = socket.id;
// IsConnected = true;
// });
// return IsConnected === true ? "Socket Connected!" : "Socket not connected!";
// }
const connectSocket = (url) => {
return new Promise((resolve, reject) => {
socket = io(url);
socket.on("connect", () => {
resolve(socket.id);
});
socket.on("connect_error", (error) => {
reject(error);
});
});
};
return IsConnected === true ? "Socket Connected!" : "Socket not connected!";
}
// function to disconnect the socket

@@ -32,0 +46,0 @@ function disconnectSocket(url) {

@@ -7,3 +7,3 @@ {

"name": "sockettwo",
"version": "1.4.1",
"version": "1.4.2",
"main": "index.js",

@@ -10,0 +10,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc