Node.js + ws + QT QML Websocket + Authentication?The definitive guide to form-based website authenticationHow do I debug Node.js applications?How do I get started with Node.jsWriting files in Node.jsHow do I pass command line arguments to a Node.js program?Check synchronously if file/directory exists in Node.jsRead environment variables in Node.jsHow to decide when to use Node.js?How to exit in Node.jsWhat is the purpose of Node.js module.exports and how do you use it?
What are the peak hours for public transportation in Paris?
Can a user sell my software (MIT license) without modification?
What is the purpose of building foundations?
How Can I Tell The Difference Between Unmarked Sugar and Stevia?
What can plausibly explain many of my very long and low-tech bridges?
`cosf`, `sinf`, etc. are not in `std`
Do you need type ratings for private flying?
How hard would it be to convert a glider into an powered electric aircraft?
Etymology of 'calcit(r)are'?
Why is the application of an oracle function not a measurement?
Why doesn’t a normal window produce an apparent rainbow?
What's the right way to purge recursively with apt?
What LISP compilers and interpreters were available for 8-bit machines?
How do photons get into the eyes?
How to make a setting relevant?
SF novella separating the dumb majority from the intelligent part of mankind
Was the Tamarian language in "Darmok" inspired by Jack Vance's "The Asutra"?
Version 2 - print new even-length arrays from two arrays
Java guess the number
What is this solid state starting relay component?
Bent spoke design wheels — feasible?
Question about JavaScript Math.random() and basic logic
Do any instruments not produce overtones?
Deformation of rectangular plot
Node.js + ws + QT QML Websocket + Authentication?
The definitive guide to form-based website authenticationHow do I debug Node.js applications?How do I get started with Node.jsWriting files in Node.jsHow do I pass command line arguments to a Node.js program?Check synchronously if file/directory exists in Node.jsRead environment variables in Node.jsHow to decide when to use Node.js?How to exit in Node.jsWhat is the purpose of Node.js module.exports and how do you use it?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
What authentication mechanisms can be used if I have a websocket server implemented in Node.js with ws like this:
const WebSocket = require('ws');
const wss = new WebSocket.Server( port: 8080 );
let theObjects = [];
wss.on('connection', function connection(ws)
ws.on('message', function incoming(message)
if (message === 'create') theObjects[username] = CreateObject();
else if (message === 'change') theObjects[username].someParam = someVal;
);
);
and a QT QML client:
WebSocket
id: socket
url: "ws://myhost.ru:8080"
onTextMessageReceived:
messageBox.text = messageBox.text + "nReceived message: " + message
onStatusChanged: if (socket.status == WebSocket.Error)
console.log("Error: " + socket.errorString)
else if (socket.status == WebSocket.Open)
var msg = command: 'create', authorization: '****', params: something: 'really cool'
socket.sendTextMessage(JSON.stringify(msg))
else if (socket.status == WebSocket.Closed)
messageBox.text += "nSocket closed"
active: false
I am not sure that this scenario is 100% correct, but at least I have the following idea on how my client should communicate with the server:
The client should be able to connect with user name and password (over WSS), create some server-side object, start some kind of data processing with this object and disconnect. When the user reconnects later it should be able to access its server-side object (by the user name or some token). While the user is connected the server-side object periodically sends some data to the client.
The question is what is the proper way to implement this and how to authenticate the user?
Personally, I did not find something related to authentication neither in QT Websocket nor in Node.js ws module
node.js authentication websocket qml
add a comment |
What authentication mechanisms can be used if I have a websocket server implemented in Node.js with ws like this:
const WebSocket = require('ws');
const wss = new WebSocket.Server( port: 8080 );
let theObjects = [];
wss.on('connection', function connection(ws)
ws.on('message', function incoming(message)
if (message === 'create') theObjects[username] = CreateObject();
else if (message === 'change') theObjects[username].someParam = someVal;
);
);
and a QT QML client:
WebSocket
id: socket
url: "ws://myhost.ru:8080"
onTextMessageReceived:
messageBox.text = messageBox.text + "nReceived message: " + message
onStatusChanged: if (socket.status == WebSocket.Error)
console.log("Error: " + socket.errorString)
else if (socket.status == WebSocket.Open)
var msg = command: 'create', authorization: '****', params: something: 'really cool'
socket.sendTextMessage(JSON.stringify(msg))
else if (socket.status == WebSocket.Closed)
messageBox.text += "nSocket closed"
active: false
I am not sure that this scenario is 100% correct, but at least I have the following idea on how my client should communicate with the server:
The client should be able to connect with user name and password (over WSS), create some server-side object, start some kind of data processing with this object and disconnect. When the user reconnects later it should be able to access its server-side object (by the user name or some token). While the user is connected the server-side object periodically sends some data to the client.
The question is what is the proper way to implement this and how to authenticate the user?
Personally, I did not find something related to authentication neither in QT Websocket nor in Node.js ws module
node.js authentication websocket qml
add a comment |
What authentication mechanisms can be used if I have a websocket server implemented in Node.js with ws like this:
const WebSocket = require('ws');
const wss = new WebSocket.Server( port: 8080 );
let theObjects = [];
wss.on('connection', function connection(ws)
ws.on('message', function incoming(message)
if (message === 'create') theObjects[username] = CreateObject();
else if (message === 'change') theObjects[username].someParam = someVal;
);
);
and a QT QML client:
WebSocket
id: socket
url: "ws://myhost.ru:8080"
onTextMessageReceived:
messageBox.text = messageBox.text + "nReceived message: " + message
onStatusChanged: if (socket.status == WebSocket.Error)
console.log("Error: " + socket.errorString)
else if (socket.status == WebSocket.Open)
var msg = command: 'create', authorization: '****', params: something: 'really cool'
socket.sendTextMessage(JSON.stringify(msg))
else if (socket.status == WebSocket.Closed)
messageBox.text += "nSocket closed"
active: false
I am not sure that this scenario is 100% correct, but at least I have the following idea on how my client should communicate with the server:
The client should be able to connect with user name and password (over WSS), create some server-side object, start some kind of data processing with this object and disconnect. When the user reconnects later it should be able to access its server-side object (by the user name or some token). While the user is connected the server-side object periodically sends some data to the client.
The question is what is the proper way to implement this and how to authenticate the user?
Personally, I did not find something related to authentication neither in QT Websocket nor in Node.js ws module
node.js authentication websocket qml
What authentication mechanisms can be used if I have a websocket server implemented in Node.js with ws like this:
const WebSocket = require('ws');
const wss = new WebSocket.Server( port: 8080 );
let theObjects = [];
wss.on('connection', function connection(ws)
ws.on('message', function incoming(message)
if (message === 'create') theObjects[username] = CreateObject();
else if (message === 'change') theObjects[username].someParam = someVal;
);
);
and a QT QML client:
WebSocket
id: socket
url: "ws://myhost.ru:8080"
onTextMessageReceived:
messageBox.text = messageBox.text + "nReceived message: " + message
onStatusChanged: if (socket.status == WebSocket.Error)
console.log("Error: " + socket.errorString)
else if (socket.status == WebSocket.Open)
var msg = command: 'create', authorization: '****', params: something: 'really cool'
socket.sendTextMessage(JSON.stringify(msg))
else if (socket.status == WebSocket.Closed)
messageBox.text += "nSocket closed"
active: false
I am not sure that this scenario is 100% correct, but at least I have the following idea on how my client should communicate with the server:
The client should be able to connect with user name and password (over WSS), create some server-side object, start some kind of data processing with this object and disconnect. When the user reconnects later it should be able to access its server-side object (by the user name or some token). While the user is connected the server-side object periodically sends some data to the client.
The question is what is the proper way to implement this and how to authenticate the user?
Personally, I did not find something related to authentication neither in QT Websocket nor in Node.js ws module
node.js authentication websocket qml
node.js authentication websocket qml
edited Mar 24 at 15:48
Alexey Starinsky
asked Mar 24 at 15:34
Alexey StarinskyAlexey Starinsky
778212
778212
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325446%2fnode-js-ws-qt-qml-websocket-authentication%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325446%2fnode-js-ws-qt-qml-websocket-authentication%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown