mordred / aurelia-sails-socket-client Goto Github PK
View Code? Open in Web Editor NEWA simple, restful, message-based wrapper around sails.io client.
License: MIT License
A simple, restful, message-based wrapper around sails.io client.
License: MIT License
Last I checked, Sails is avail on npm
https://www.npmjs.com/package/sails
So why not just
jspm install npm:sails
OK, I get some errors but... I would assume that if you can install via npm
it should install just as well via jspm
?
I hope the title is the correct terminology..
Basically I am trying to have an Aurelia App(running on localhost:9000) connect to a sails app running (localhost:1337) and cannot get the aurelia-sails-socket-client to connect.
I have mostly replicated the example you have provided by tried to break the example into two separate components.
The error I am getting in the Chrome console is:
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:9000/socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_sdk_platform=browser&__sails_io_sdk_language=javascript&EIO=3&transport=polling&t=1455165127101-1
sails.io.js:156
Socket is trying to reconnect to Sails...
_-|>_- (attempt #2)
I have changed the items where I think I need to and have tried modifying main.js
in the Aurelia app to be the following:
.plugin('aurelia-sails-socket-client', (sails) => {
sails.configure(x => {
x.withBaseUrl('http://localhost:1337/api/v1');
*** and have tried leaving it as x.withBaseUrl('/api/v1');
and changed the lines in app.js
(Aurelia App) to be like: (I have changed all the relevant lines to be like this...
addTodo(todo) {
this.sails.post('http://localhost:1337/todos', todo).then((response) => {
this.todos.push(new Todo(response.body));
this.todo = new Todo({
title: '',
completed: false
});
});
}
I'm sure I should be able to connect the two apps together but for the life I me cannot get this to work. The console on sails app with silly logging doesn't even register that the Aurelia app has tried to make a connection.
Any advice? Thanks heaps in advance. (I hope I'm not doing something stupid)
Hi @Mordred ,
I've just finished setting up a sails app which serves an aurelia app and I'm quite interested in this plugin. Is there anything special I need to do to get this running?
Ran through all the install/setup instructions on the main README, then tried out your example app:
npm install
sails lift
However I get a System is not defined
error in browser control, after opening localhost:1337
Then I tried jspm install -y
since I could see some jspm entries in the example/packages.json
file
"jspm": {
"directories": {
"baseURL": "assets"
},
"dependencies": {
"aurelia-animator-css": "github:aurelia/animator-css@^0.2.0",
However...
warn Error on getPackageConfig for github:aurelia/router, retrying (1).
GitHub rate limit reached. To increase the limit use GitHub authentication.
Run jspm registry config github to set this up, or add the credentials to your ~/.netrc file.
But I guess this is an issue with my own settings I need to fix. Would be nice with some instructions for running example app in the main README. Cheers :)
Tip: Run jspm registry config github
in order to fix this locally if this problem is encountered :)
Hey
Thanks for the excellent example. I am coming from Meteor and love both Aurelia and Sails and your example works great with sails lift
.
but...
If I execute with sails lift --prod
to execute in production mode the example doesn't work.
The error in Chrome console is:
http://localhost:1337/js/production.js Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:1337/js/production.js
localhost/:1 Uncaught (in promise) Error: XHR error (404 Not Found) loading http://localhost:1337/js/production.js(…)
The error from sails is:
sails-hook-sockets :: connected to Sails admin message bus.
Rendering view: "homepage" (located @ "C:\Users\Jason\Documents\Visual Studio 2015\Projects\Aurelia-Sails-Sockets\views\homepage")
• using configured layout:: layout (located @ "C:\Users\Jason\Documents\Visual Studio 2015\Projects\Aurelia-Sails-Sockets\views\layout")
Sending 404 ("Not Found") response
Rendering view: "homepage" (located @ "C:\Users\Jason\Documents\Visual Studio 2015\Projects\Aurelia-Sails-Sockets\views\homepage")
• using configured layout:: layout (located @ "C:\Users\Jason\Documents\Visual Studio 2015\Projects\Aurelia-Sails-Sockets\views\layout")
Sending 404 ("Not Found") response
These errors do not occur with sails lift
and this is the example exactly as it was downloaded today.
Thanks for any advice you can provide.
I've verified that it works by adding text to homepage.ejs
, but it should probably display something on its own.
Hi, I'm using this project with my aurelia-sails applications it's working great but I have a question, is there any partocular reason autoconnect is disabled?
I see it was disabled in this commit and I added it on my plugin configuration but no luck so far on reconnecting
this is my conf
.plugin('aurelia-sails-socket-client', (sails, io) => {
sails.configure(conf => {
if (environment.debug) {
io.sails.url = devConf.sailsSocketURL;
io.sails.autoConnect = true;
conf.withBaseUrl(devConf.sailsSocketURL);
conf.withInterceptor(new LoggerInterceptor());
} else {
conf.withBaseUrl(prodConf.sailsSocketURL);
io.sails.url = prodConf.sailsSocketURL;
}
});
})
This is my code for the backend:
this.sails.post("/login", credentials)
.then((response) => alert("Success login"))
.catch((response) => alert("Wrong credentialsssss!!"));
Getting the following error on js console. Even if I am sending a post the socket message reads as get and the ur; is not being picked up.
SocketRequestMessage {method: "get", url: "/csrfToken", content: undefined, headers: Headers, baseUrl: "http://localhost:1337"…}
baseUrl: "http://localhost:1337"
content: undefined
headers: Headers
interceptors: Array[2]
method: "get"
options: (...)
url: "/csrfToken"
__proto__: SocketRequestMessage
constructor: SocketRequestMessage(method, url, content, headers)
options: (...)
get options: ()
__proto__: Object
Hi,
If you get the chance please send me your email so I can make a private request.
Thanks,
John
[email protected]
Hi,
I just installed your repo and followed instructions for the example directory. I then opened 2 browers expecting to see each browser updated on socket when adding todo but nothing was updated.
Thanks for this repo as I think this combo will be awesome.
john
Windows 10
Node 0.12.7
npm 2.13.4
Hi,
Thanks for this repo. I'm a long time user of sails and past contributor (https://github.com/SharePointOscar/MEANS, nodemachines etc). Have been using Aurelia since June and I'm hooked. Currently I'm using sails as a separate backend rest service with Aurelia on the frontend using fetch. I'd like to explore this socket example separating each part and before I start I was wondering what thoughts you might have and I'f you'd like to collaborate. I'd like to wind up with a means stack, just a different A and as a backend and frontend service similar to tarlap's example with Angular (https://github.com/tarlepp/angular-sailsjs-boilerplate).
John
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.