And there is a question about ws connections. I want to establish one connection for each user and make it live before reconnecting. The following code that I saw on the network is something bad, because I think that with each action, creating a client connection and sending a message and then destroying it is not a good practice. Please help. and do not send me official documents.
const actions = { connectWsForUserTracking({state, commit},data){ const protocol = avro.readProtocol(' protocol RemoteLogService { void log(enum { INFO, WARNING } level, bytes message); } '); const logClient = avro.Service.forProtocol(protocol) .createClient({buffering: true,transport: ws('ws://localhost:8026')}); setTimeout(function () { logClient.destroyChannels(); }, 1000); }, trackingMessageContent(context,data){ import('../../avroSchema/v1/schema.js').then(schemaConfig => { console.log(schemaConfig); const exactType = avro.Type.forSchema(schemaConfig.default);
}
Stefan bubonja
source share