@therms/rpc-server
Advanced tools
Comparing version 2.7.0 to 2.8.0
@@ -0,1 +1,8 @@ | ||
# [2.8.0](https://bitbucket.org/thermsio/rpc-server-ts/compare/v2.7.0...v2.8.0) (2022-06-13) | ||
### Features | ||
* refactor logic for RPC client websocket identity change ([9ddd791](https://bitbucket.org/thermsio/rpc-server-ts/commits/9ddd7914b09c8488a09a4b5be4419641098e7c2a)) | ||
# [2.7.0](https://bitbucket.org/thermsio/rpc-server-ts/compare/v2.6.0...v2.7.0) (2022-06-13) | ||
@@ -2,0 +9,0 @@ |
@@ -15,2 +15,3 @@ 'use strict'; | ||
var uuid = require('node-uuid'); | ||
var lodashEs = require('lodash-es'); | ||
var os = require('os'); | ||
@@ -964,9 +965,12 @@ var lodash = require('lodash'); | ||
} | ||
if (!identity?.authorization && clientMsg.identity?.authorization) { | ||
if (this.options.config?.gatewayServer?.websocket?.onClientConnect) { | ||
this.options.config.gatewayServer.websocket.onClientConnect({ | ||
connectionId: websocketId, | ||
identity: clientMsg.identity, | ||
ip: wsIp, | ||
}); | ||
if (clientMsg.identity) { | ||
if (this.options.config?.gatewayServer?.websocket | ||
?.onClientConnectionIdentityChanged) { | ||
if (!lodashEs.isEqual(clientMsg.identity, identity)) { | ||
this.options.config.gatewayServer.websocket.onClientConnectionIdentityChanged({ | ||
connectionId: websocketId, | ||
identity: clientMsg.identity, | ||
ip: wsIp, | ||
}); | ||
} | ||
} | ||
@@ -973,0 +977,0 @@ } |
@@ -9,2 +9,3 @@ import WsServer from 'ws'; | ||
import uuid from 'node-uuid'; | ||
import { isEqual } from 'lodash-es'; | ||
const debug = Debug('rpc:WebSocketServer'); | ||
@@ -141,9 +142,12 @@ export class WebSocketServer { | ||
} | ||
if (!identity?.authorization && clientMsg.identity?.authorization) { | ||
if (this.options.config?.gatewayServer?.websocket?.onClientConnect) { | ||
this.options.config.gatewayServer.websocket.onClientConnect({ | ||
connectionId: websocketId, | ||
identity: clientMsg.identity, | ||
ip: wsIp, | ||
}); | ||
if (clientMsg.identity) { | ||
if (this.options.config?.gatewayServer?.websocket | ||
?.onClientConnectionIdentityChanged) { | ||
if (!isEqual(clientMsg.identity, identity)) { | ||
this.options.config.gatewayServer.websocket.onClientConnectionIdentityChanged({ | ||
connectionId: websocketId, | ||
identity: clientMsg.identity, | ||
ip: wsIp, | ||
}); | ||
} | ||
} | ||
@@ -150,0 +154,0 @@ } |
@@ -32,2 +32,7 @@ import { HandlerRegistrationInfo, RPCServerHandler } from '../Handler'; | ||
}) => void; | ||
onClientConnectionIdentityChanged?: (connection: { | ||
connectionId: string; | ||
identity?: RPCClientIdentity; | ||
ip?: string; | ||
}) => void; | ||
onClientDisconnect?: (connection: { | ||
@@ -34,0 +39,0 @@ connectionId: string; |
{ | ||
"name": "@therms/rpc-server", | ||
"version": "2.7.0", | ||
"version": "2.8.0", | ||
"description": "RPC framework, Node.js lib", | ||
@@ -5,0 +5,0 @@ "private": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
981166
5749