Possible to run ofxLibwebsockets as client and connect to localhost?
jshaw opened this issue · 3 comments
I'm trying to get my OF app using the ofxLibwebsockets addon to connect to my localhost on port :4200 and am running into connection issues. I can connect to the echo.websockets.org example in the package but no dice for anything locally.
I have the host, protocol, port etc... set up however the only thing that I can see that might be causing the issue is the bUseSSL
option. It formats the url that is making the request to xxx.xxx.x.xxx:4200/:0
when I set bUseSSL
to false -- since I'm not using SSL.
I'm running Node.js as my local server and I'm doing the websockets with Socket.io. I can also connect to my localhost from other web devices on the network using the localhost's IP without an issue connecting to xxx.xxx.x.xxx:4200
The verbose log i'm getting from OF is
[verbose] [ofxLibwebsockets] connect: xxx.xxx.x.xxx:4200/:0
[verbose] [ofxLibwebsockets] Setting timeout 10
[verbose] [ofxLibwebsockets] LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS
[verbose] [ofxLibwebsockets] LWS_CALLBACK_PROTOCOL_INIT
[verbose] [ofxLibwebsockets] libwebsocket init success
[verbose] [ofxLibwebsockets] LWS_CALLBACK_LOCK_POLL
[verbose] [ofxLibwebsockets] LWS_CALLBACK_ADD_POLL_FD
[verbose] [ofxLibwebsockets] LWS_CALLBACK_UNLOCK_POLL
[verbose] [ofxLibwebsockets] LWS_CALLBACK_LOCK_POLL
[verbose] [ofxLibwebsockets] LWS_CALLBACK_CHANGE_MODE_POLL_FD
[verbose] [ofxLibwebsockets] LWS_CALLBACK_UNLOCK_POLL
[verbose] [ofxLibwebsockets] Connection successfully created. Connecting.
[ error ] [ofxLibwebsockets] Connection error
on close
For the ofxLibwebsockets addon to work does it need to be connecting to a remote server like Heroku? And is there a way to remove the "/:0:" from the end of the url being requested in the plugin?
Any guidance would be awesome too!
Cheers,
Hello! I'm sorry you're having issues, but let's figure it out! Quick questions and answers below:
- What platform are you on (e.g. Mac / Windows / Linux + any other details)
- Do you get any messages from your server about the app connecting? If you can put it into a debug/verbose mode and post stuff here, that'd be great.
- Have you tried both your IP address and "localhost"? Do both not work?
The URL you are seeing is actually just the way the log message is formatted; confusing, I know! The URL is correct, and the rest of the message is letting you know what channel it's on and whether it's SSL. I'll make that more clear in the future!
Overall, the biggest issue is most likely Socket.IO. Check out this issue for a bit more detail:
#30
Socket pretty much needs its own library to work, as it does a lot more than just websockets. I'd suggest either a) using the specific Socket.IO OF library or b) switching to just raw websockets on the server end.
Keep me posted here on where you end up!
Best,
Brett
Hey!
I'm using a mac, Yosemite 10.10.5, most recent chrome browsers etc. I'm running OFX 0.8.4 and the most recent Socket.io version. Yep, I've also tried both my server IP as well as local host without any luck. I ran my node server in debug mode but it seems that the connection from the ofx app wasn't making it to my node server.
It's been suggested for me to try https://github.com/dpallot/simple-websocket-server which I was able to get a basic prototype running with ofxLibwebsockets it seems like it might be related to Socket.io as you mentioned.
I'll play around a bit more to see what I can out of the NodeJS + Socket.io stack and investigate additional WebSockets solutions for Node.
Thanks for the great feedback and starting points for roads to investigate further!
I'll post back any finds I come up with about Socket.io.
Cheers,
Quick note for those in the future: the excellent Soixante Circuits have put together an ofxSocketIO addon! https://github.com/soixantecircuits/ofxSocketIO