mike 0 Posted December 29, 2020 Report Share Posted December 29, 2020 I Have looked at the websocketserver demo in SMS..but how can i pass parameters from websocket client request? for example on stackoverflow : CLIENT - var ws = new WebSocket('ws://localhost:1234/?id=1&name=foo'); SERVER - const url = require('url'); wss.on('connection', function connection(ws, req) { console.log(url.parse(req.url, true).query); // { id: '1', name: 'foo' } }); How can i translate this in SMS? can someone point me in the right direction?? Mabe it is real simple in SMS..but i'm new to websockets. Mike Quote Link to post Share on other sites
Administrators jarto 724 Posted January 4 Administrators Report Share Posted January 4 I had a quick look at SmartNJ.Server.WebSocket.pas. It currently does this: // catch and cache remote URL if (request) then begin if (request.connection) then NJSocket.RemoteAddress := request.connection.remoteAddress; end; Maybe this could be changed to: // catch and cache remote URL if (request) then begin if (request.connection) then begin NJSocket.RemoteAddress := request.connection.remoteAddress; NJSocket.RemoteUrl := request.url; end; end; After that you could parse the parameters from RemoteUrl. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.