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

@cubetiq/hws

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cubetiq/hws - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

dist/cli.js

32

dist/server.js

@@ -9,5 +9,5 @@ "use strict";

const socket_io_1 = require("socket.io");
const express_1 = __importDefault(require("express"));
const body_parser_1 = __importDefault(require("body-parser"));
const cors_1 = __importDefault(require("cors"));
const express_1 = __importDefault(require("express"));
const emitter_1 = require("./emitter");

@@ -66,4 +66,4 @@ const serverio_1 = __importDefault(require("./serverio"));

});
socket.on("random", (data) => {
console.log(`random data: ${data}`);
socket.on("message", (data) => {
socket.broadcast.emit("message", data);
});

@@ -77,3 +77,3 @@ });

});
// dynamic namespace startsWith (nsp-*) for receive events
// dynamic namespace startsWith (*) for receive events
io.of(/^\/.+$/).on("connection", async (socket) => {

@@ -121,2 +121,8 @@ const nsp = socket.nsp;

});
app.get("/:event", (req, res) => {
sendEvent(req, res);
});
app.post("/:event", (req, res) => {
sendEvent(req, res);
});
app.get("/:namespace/:event", (req, res) => {

@@ -131,10 +137,3 @@ sendEvent(req, res);

const suffixNs = req?.params?.namespace?.trim();
const namespace = `${suffixNs}`;
if (!suffixNs) {
res.type("json");
res.send({
message: "Namespace is required",
status: "ERROR",
});
}
const namespace = suffixNs;
let body = req?.body;

@@ -147,5 +146,10 @@ if (Object.keys(body).length === 0) {

// Emit event to namespace
(0, emitter_1.IOEmitterOf)(namespace, event, body);
if (namespace) {
(0, emitter_1.IOEmitterOf)(namespace, event, body);
}
else {
(0, emitter_1.IOEmitter)(event, body);
}
const r = {
namespace: namespace,
namespace: namespace || null,
event: event,

@@ -152,0 +156,0 @@ body: body,

{
"name": "@cubetiq/hws",
"version": "0.0.2",
"description": "CUBETIQ HTTP WebSocket Server using Socket.IO",
"version": "0.0.3",
"description": "CUBETIQ HTTP WebSocket Server and Client using Socket.IO",
"main": "dist/app.js",

@@ -20,3 +20,4 @@ "bin": {

"socket.io",
"websocket"
"websocket",
"sockcet.io-client"
],

@@ -26,2 +27,3 @@ "author": "Sambo Chea <sombochea@cubetiqs.com>",

"dependencies": {
"axios": "^0.27.2",
"body-parser": "^1.20.0",

@@ -31,3 +33,4 @@ "commander": "^9.3.0",

"express": "^4.17.1",
"socket.io": "^4.2.0"
"socket.io": "^4.2.0",
"socket.io-client": "^4.5.1"
},

@@ -34,0 +37,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

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