@alizadefaig/pos-server 1.2.21 → 1.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils.js +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alizadefaig/pos-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.22",
|
|
4
4
|
"description": "Server in express js with Proxy to Main server if need and will work with Electron JS",
|
|
5
5
|
"homepage": "https://gitlab.com/faigalizade/pos-server#readme",
|
|
6
6
|
"bugs": {
|
package/utils.js
CHANGED
|
@@ -99,6 +99,16 @@ const socketSendByFilter = ({companyId, eventName, data, to, toId, excepts}, ser
|
|
|
99
99
|
|
|
100
100
|
if (!to) {
|
|
101
101
|
serverSocket.to(companyId).emit(eventName, data);
|
|
102
|
+
} else if (to === 'terminal' && toId) {
|
|
103
|
+
const room = serverSocket.sockets.adapter.rooms.get(companyId);
|
|
104
|
+
if (room) {
|
|
105
|
+
for (const socketId of room) {
|
|
106
|
+
const sock = serverSocket.sockets.sockets.get(socketId);
|
|
107
|
+
if (sock && sock.terminalId === toId) {
|
|
108
|
+
sock.emit(eventName, data);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
102
112
|
}
|
|
103
113
|
}
|
|
104
114
|
|