Open hartatovich opened 3 years ago
@hartatovich Thanks for posting! We'll take a look as soon as possible.
In the mean time, there are a few ways you can help speed things along:
Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.
For help with questions about Sails, click here.
Hi @hartatovich, We recommend writing an action to subscribe to the socket that recreates a JSON websocket response object. We also recommend taking a look at how sockets emit in the sails.io.js source code .
Node version: 12.19.1 Sails version (sails): 1.4.0 ORM hook version (sails-hook-orm): 2.1.1 Sockets hook version (sails-hook-sockets): 2.0.0 Organics hook version (sails-hook-organics): 0.16.1 Grunt hook version (sails-hook-grunt): 4.0.1
I'm trying to implement some tests for my socket and I can't find a way to subscribe to User events without using sails.js virtual GET inside SailsSocket class
the application frontend code looks something like that
and the backend sails.js code looks like this:
so far so good and everything works pretty well on the application side.
my problem starts when i'm trying to connect with a different client side code on a socket class that don't have virtual GET I'm using k6, its a load testing tool with some API to connect to sockets.
I'm not sure if virtual GET is part of the web socket protocol or how everything really works around that with sails.js
I changed the url to use the ws protocol (was originally http) and I managed to connect the socket from k6, however was not able to receive any user event that published on the backend
I can't figure out how to subscribe to those user events outside the client side code inside my application.. (k6 or any other socket library)
thanks for all those that spend the extra time reading all this! :)
some related links:
https://k6.io/docs/javascript-api/k6-ws/socket/
https://sailsjs.com/documentation/reference/web-sockets/socket-client/io-socket-get
https://sailsjs.com/documentation/reference/web-sockets/socket-client/sails-socket