sails.io.js

SailsJS stream status from backend to frontend

泪湿孤枕 提交于 2019-12-25 04:06:58
问题 In my webapp I use SailsJS backend to fetch data from an API (facebook graph api) and that fetched data will be saved on the database on the backend when it has finished fetched. So my question is when I make a request to the backend to do all this work how do I show the user how much of it has been completed. At the moment all I can show is a loading icon. But I like to show something like 1% completed, 89% completed as such a sailsjs app create 1000 records on the backend. Right. and when

socket connection always failing

喜欢而已 提交于 2019-12-24 14:32:01
问题 I'm writing an application that connects to a sails server. This application is written with cordova , angularJS and Ionic . When I launch my application in my browser (with ionic serve ) the socket fails to connect to the server. Here is the message I get: GET http://localhost:8100/socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_s…sails_io_sdk_language=javascript&EIO=3&transport=polling&t=1443472067762-4 404 (Not Found) The server is running locally on port 1337. I tried to change the

Sails.io.js io.socket.get('/user',…) Not implemented in core yet

不问归期 提交于 2019-12-20 06:21:49
问题 Create e.g. assets/js/dependencies/app.io.js with: io.socket.on('connect', function socketConnected() { console.debug("This is from the connect: ", io.socket); console.debug("WebSocket is connected:", io.socket.isConnected()); io.socket.get('/user', function(resData) { console.debug(resData); }); }); Console |> Now connected to Sails. \___/ For help, see: .... (using sails.io.js browser SDK @v0.13.7) app.io.js:3 This is from the connect: SailsSocket {headers: undefined, eventQueue: Object,

How to get current socket object or id with in a sails controller?

筅森魡賤 提交于 2019-12-20 03:57:31
问题 I would like to access the currently connected socket id with in a sails.js (v0.12 ) controller function. sails.sockets.getId(req.socket); is showing undefined since this is not a socket request My objective is to set the online status of my user in the database when he logged in successfully login: function (req, res) { Util.login(req, function(){ var socketId = sails.sockets.getId(req.socket); console.log('socketId ===', socketId); // return undefined }); }, Basically i would like to access

Connect from a client to a sails based server

痴心易碎 提交于 2019-12-08 04:15:59
问题 I am trying to connect to my sails based server from my cordova client using the library sails.io. this is my client code: <!-- cordova script (this will be a 404 during development) --> <script src="lib/ngCordova/dist/ng-cordova.js"></script> <script src="cordova.js"></script> <script src="lib/angular-socket-io/socket.js"></script> <script src="lib/angular-sails/src/ngSails.js"></script> <script src="lib\socket.io-client\socket.io.js"></script> <script src="lib/sails.io.js/sails.io.js"><

How to connect Socket.IO-Client to Sails.js server?

こ雲淡風輕ζ 提交于 2019-12-06 05:55:17
I've spent quite a while trying to connect Socket.IO-Client to a server running on Sails.js framework. The client is basically a simple JavaScript application running with Node.js on Raspberry Pi. The idea is that a simple device connects to a server, the server then registers the device and subscribes it for messages. The device receives a message from the server and performs some actions. I don't want the client to be dependant on any framework and, for that reason, I am trying to avoid using Sailsjs-socket.io-client. At the moment both server and the client are running on my local machine.

Sails.io.js io.socket.get('/user',…) Not implemented in core yet

别说谁变了你拦得住时间么 提交于 2019-12-02 10:54:59
Create e.g. assets/js/dependencies/app.io.js with: io.socket.on('connect', function socketConnected() { console.debug("This is from the connect: ", io.socket); console.debug("WebSocket is connected:", io.socket.isConnected()); io.socket.get('/user', function(resData) { console.debug(resData); }); }); Console |> Now connected to Sails. \___/ For help, see: .... (using sails.io.js browser SDK @v0.13.7) app.io.js:3 This is from the connect: SailsSocket {headers: undefined, eventQueue: Object, isConnecting: false, extraHeaders: Object, hostname: "localhost"…} app.io.js:4 WebSocket is connected:

Sails socket io connecting to a different url than the one passed in

梦想与她 提交于 2019-12-02 08:03:38
问题 In production when I try to connect to my socket client in sails at 'https://something.com/api/' from the client url 'https://something.com/' I get a 404 https://something.com/socket.io/?__sails_io_sdk_version=0.13…owser&__sails_io_sdk_language=javascript&EIO=3&transport=polling&t=LFGJG5g 404 (Not Found) When I establish a socket connection in sails on my local machine it works. My Local Configuration. CLIENT HOST http://localhost:8080/ API HOST http://localhost:1337/ HTML <script src="sails

How to get current socket object or id with in a sails controller?

我只是一个虾纸丫 提交于 2019-12-02 07:29:14
I would like to access the currently connected socket id with in a sails.js (v0.12 ) controller function. sails.sockets.getId(req.socket); is showing undefined since this is not a socket request My objective is to set the online status of my user in the database when he logged in successfully login: function (req, res) { Util.login(req, function(){ var socketId = sails.sockets.getId(req.socket); console.log('socketId ===', socketId); // return undefined }); }, Basically i would like to access the current user's socket object in a controller or access current user's session object with in a

Sails socket io connecting to a different url than the one passed in

自古美人都是妖i 提交于 2019-12-02 04:08:28
In production when I try to connect to my socket client in sails at ' https://something.com/api/ ' from the client url ' https://something.com/ ' I get a 404 https://something.com/socket.io/?__sails_io_sdk_version=0.13…owser&__sails_io_sdk_language=javascript&EIO=3&transport=polling&t=LFGJG5g 404 (Not Found) When I establish a socket connection in sails on my local machine it works. My Local Configuration. CLIENT HOST http://localhost:8080/ API HOST http://localhost:1337/ HTML <script src="sails.io.js" autoConnect="false"></script> JS connect() { this.socket = io.sails.connect('http:/