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

node-red-contrib-viseo-bot-socketio

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-viseo-bot-socketio - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

35

node-socketio-server.js

@@ -47,3 +47,3 @@ const helper = require('node-red-viseo-helper')

RED.nodes.registerType("socketio-server-config", registerConfig);
RED.nodes.registerType("socketio-server-config", registerConfig);
RED.nodes.registerType("socketio-server", registerNode, { credentials: { secret: {type: "text"}} });

@@ -80,3 +80,3 @@ }

const bindIOServer = (node, config) => {
const bindIOServer = (node, config) => {
if (!io) { return log("WebSocket server not available..."); }

@@ -87,3 +87,3 @@

io.on('connection', (socket) => {
io.on('connection', (socket) => {
let client = { "socket" : socket, replies : {} }

@@ -136,11 +136,13 @@ CLIENTS[client.socket.id] = client;

// Set the convId to the socketId
message.socket = client.socket.id
// Bind ClientID to socket's data (if provided)
if (message._client_id){
client._client_id = message._client_id
message.socket = client._client_id // override the convId with a generic reference
}
message.socket = client.socket.id
let data = botmgr.buildMessageFlow({ "message" : message }, {
userId: 'message._client_id',
userId: 'message._client_id',
convId: 'message.socket',

@@ -151,5 +153,5 @@ payload: 'message.content',

})
// Handle Prompt
let convId = botmgr.getConvId(data)
let convId = botmgr.getConvId(data);
if (botmgr.hasDelayedCallback(convId, data.message)) return;

@@ -170,3 +172,3 @@

let namespace = config.namespace || 'assistant';
try {

@@ -184,6 +186,6 @@

let client = CLIENTS[socket];
if (!client){
if (!client){
let userId = data.user.id
if (!userId){ return node.warn('Client SocketId ' + socket + ' not found ')}
// Find the first client matching given userID has a fallback

@@ -193,3 +195,6 @@ for (let sock of Object.keys(CLIENTS)){

if (c._client_id === userId){
client = c;
client = c;
// node.warn('Override Conversation ID: ' + client.socket.id)
// helper.setByString(data, 'user.address.conversation.id', client.socket.id)
node.warn('Conversation ID custom: ' + botmgr.getConvId(data))
break;

@@ -199,3 +204,3 @@ }

if (!client){
if (!client){
node.warn('Client SocketId ' + socket + ' not found for userId '+ userId)

@@ -207,3 +212,3 @@ return;

// Store a replyId x data to a given Socket
// and wait client acknowledge message
// and wait client acknowledge message
// to call: helper.fireAsyncCallback(data);

@@ -248,2 +253,2 @@ let replyId = uuidv4();

return replies[0];
}
}
{
"name" : "node-red-contrib-viseo-bot-socketio",
"version" : "0.2.0",
"version" : "0.2.1",
"description" : "VISEO Bot Maker - SocketIO channel connector",

@@ -5,0 +5,0 @@ "dependencies" : {

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