fix(core): update
This commit is contained in:
@ -16,20 +16,16 @@ export class TypedSocket {
|
||||
smartexpressServerArg?: any
|
||||
): Promise<TypedSocket> {
|
||||
const smartsocketServer = new plugins.smartsocket.Smartsocket({
|
||||
alias: 'typedsocketServer',
|
||||
port: 3000,
|
||||
});
|
||||
if (smartexpressServerArg) {
|
||||
smartsocketServer.setExternalServer('smartexpress', smartexpressServerArg);
|
||||
}
|
||||
const publicRole = new plugins.smartsocket.SocketRole({
|
||||
name: publicRoleName,
|
||||
passwordHash: await plugins.isohash.sha256FromString(publicRolePass),
|
||||
});
|
||||
smartsocketServer.addSocketRoles([publicRole]);
|
||||
|
||||
smartsocketServer.socketFunctions.add(
|
||||
new plugins.smartsocket.SocketFunction({
|
||||
funcName: 'processMessage',
|
||||
allowedRoles: [publicRole],
|
||||
funcDef: async (dataArg, socketConnectionArg) => {
|
||||
return typedrouterArg.routeAndAddResponse(dataArg);
|
||||
},
|
||||
@ -73,10 +69,8 @@ export class TypedSocket {
|
||||
): Promise<TypedSocket> {
|
||||
const domain = new plugins.smartstring.Domain(serverUrlArg);
|
||||
|
||||
const socketOptions = {
|
||||
const socketOptions: plugins.smartsocket.ISmartsocketClientOptions = {
|
||||
alias: aliasArg,
|
||||
role: publicRoleName,
|
||||
password: publicRolePass,
|
||||
port: domain.port || 3000,
|
||||
url: `${domain.nodeParsedUrl.protocol}//${domain.nodeParsedUrl.hostname}`,
|
||||
autoReconnect: true,
|
||||
@ -87,7 +81,6 @@ export class TypedSocket {
|
||||
smartsocketClient.addSocketFunction(
|
||||
new plugins.smartsocket.SocketFunction({
|
||||
funcName: 'processMessage',
|
||||
allowedRoles: [],
|
||||
funcDef: async (dataArg, socketConnectionArg) => {
|
||||
return typedrouterArg.routeAndAddResponse(dataArg);
|
||||
},
|
||||
|
Reference in New Issue
Block a user