Websocket, Error 404 in voltrb - voltrb

I tried deploying a volt application using Docker via cloud66.
The image is deployed, the page is accessible but i can not login because i get the error :
WebSocket connection to 'wss://mps_sports_c66.totole.xyz/socket' failed: Error during WebSocket handshake: Unexpected response code: 404
Is there something special to do while deploying with a docker image?
Cheers,
Kevin

Websockets upgrade a http connection, so if you can get stuff back from the http request, then the issue is that cloud66 has a non-websocket compatible http proxy between you and your server.
http://community.cloud66.com/articles/cloud-66-websocket-support
I added a config option (on master) to specify the websocket url, see the docs here: https://github.com/voltrb/docs/blob/master/en/deployment/README.md#custom-socket-url To run off of master, change your gemfile to use:
gem 'volt', github: 'voltrb/volt'
then run bundle
If you get things working on cloud66, would you mind adding docs for setting it up to the docs repo? https://github.com/voltrb/docs
Thanks!

Related

slash command "dispatch_failed"

I have went through creating the custom slash command configuration via slack and installed it on workspace. However when I run it I get this
/testing failed with the error "dispatch_failed"
I tried multiple workspaces but same issue. Anyone experienced this?
So after a few tests, I found out that this is just a generic message of anything that fails at slack at this point. I have first my endpoint that was unreachable. So it was returning this message. I fixed that, used ngrok for tunnel so that I could debug and that is how I found this issue.
Also, this error can occur due to the following reasons as well.
Errors in code
Unreachable backend or Invalidly configured slash command in the app
While the documentation tells you:
"use the Request URL is your base server link + "/slashcommand" after it"
This is incorrect. The request URL should be: "/slack/events"
Of course the command needs to match whats in the 'edit command' window and in the method '.command' in your app.js:
app.command('/flash-card', async ({ ack, body, client })
If you're using ngrok http <port> to test in your localhost, be aware that a new ngrok public URL is created every time you run this command. So in https://api.slack.com/apps, in your app's Features, you may have to update your Slash Command' request URL with the current ngrok URL generated for you.
You need to set the Method in the Integration Settings to GET, is default to POST
This is also the error for a 404 Not Found.
If you're developing offline with ngrok, the 404 error can be seen in the terminal.
If you're deploying with serverless, ensure that you're handling the new endpoint /slack/command. One solution is to create a separate handler, i.e. /command.js
functions:
slack:
handler: app.handler
events:
- http:
path: slack/events
method: post
command:
handler: command.handler
events:
- http:
path: slack/command
method: post
[If your code is executing and u still have this error]
In my case using Slackbolt with js I forgot to add
await ack();
in called function so Slack api throw error.

Socket.io-client Failed to load resource

I have this issue trying to connect to websocket using socket.io-client (Socket.IO.js build:0.9.16)
Failed to load resource: the server responded with a status of 404 (Not Found)
XMLHttpRequest cannot load https://myserver.it/socket.io/1/?t=1488475368547. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://my_vps_ip' is therefore not allowed access. The response had HTTP status code 404.
the strange things are:
localhost it works fine
in amazon ec2 instance it works fine
in another vps (cloud vps bought here) it doesn't works
This is my code:
socket = io.connect('https://myserver.it' ,{
transports: ['websocket'],
secure: true,
'force new connection' : false,
'reconnect' : true,
});
Apache 2.4.18 in twice VPS, same configuration, same modules
I really don't understand ...
I dunno if this help but I've faced with same kind of problem time ago.
Check your URL and ensure it NOT end with /
e.g. https://myserver.it/ != https://myserver.it
It looks like you've run into a CORS issue. You need to make sure that you are explicitly allowing access to the requested resource.
You may want to look at enable-cors.org former guidance.

SockJS on IE9 - getting ERROR - Incompatibile SockJS! Main site uses: "1.0.3", the iframe: "1.0.0"

I am using SockJS 1.0.3 for websocket with fallback support. Using Spring Websocket API with SockJS on the server side.
Everything seems to be working fine except when I try and connect using IE9. As the browser tries to connect to the URL, following message is displayed on the console
Incompatibile SockJS! Main site uses: "1.0.3", the iframe: "1.0.0"
After throwing this message, the connection gets established, however, after approx. 60 seconds the connection gets closed automatically. I don't get such behavior on any other browser (Mozilla / Chrome / IE11).
Anyone having any clue on what's going on actually.
Please help!!
The issue got resolved finally. Resolution was in the error message, so changed the SockJS version from 1.0.3 to 1.0.0
Now, don't see the "Incompatible SockJS Message" on console and the connection too is not closed automatically.

Error during WebSocket handshake: Unexpected response code: 400 on free OpenShift MEAN stack server

I'm working on twitter search web app http://twitter.batak.tk/ and locally everything works fine but when I deploy it on OPENSHIFT MEAN stack server (free) I'm getting this error:
WebSocket connection to 'ws://nodejs-igrica.rhcloud.com/socket.io/?EIO=3&transport=websocket&sid=Wtvf6VI-9QqTvICUAAAI' failed: Error during WebSocket handshake: Unexpected response code: 400
twitter.batak.tk is just an alias to nodejs-igrica.rhcloud.com.
This is my socket service code:
app.
factory('SearchService', ['socketFactory', function(socketFactory) {
var myIoSocket = io.connect('http://nodejs-igrica.rhcloud.com/:8000', {'forceNew':true });
mySocket = socketFactory({
ioSocket: myIoSocket
});
return mySocket;
}]);
and this is a server.js:
https://github.com/isBatak/twitter_search_web_app/blob/master/server.js
I'm stuck with this...
The problem came from Openshift. You have to specify the port sockets are going to use. Just had to write:
var ioSocket = io.connect('http://my-site.rhcloud.com:8000');
You must use port 8000.
Source: question/answer, same problem like you
Extra
You should use a subdomain to access your openshift app. Use for example:
http://node.yourdomain.com:8000
Instead of
http://my-site.rhcloud.com:8000
Remember, you have to set up an alias for your gear in OpenShift in order to be correctly redirected.
Hi did you try your server using the websocket.org echo service?

How to solve socket.io 0.9+ Cross domain

I use socket. IO to do a chat application, the client is 0.8.4 and running normally. But when I put the socket. 0.9.4 IO upgrade to find the cross domain problem, other documents did not change, the following is wrong content:
XMLHttpRequest cannot load http://localhost:8000/socket.io/1/? T = 1333528698474. http://mydomain.com Origin is not allowed by Access-Control-Allow-Origin.
Some people have the same problem? Or who know solution? Thank humbly!
I just got mine working by using http:// in my browser address bar instead of file://
This was my issue: https://github.com/LearnBoost/socket.io/issues/776
Set the Access-Control-Allow-Origin header to your URL in the response.
NodeJS sample using setHeader:
res.setHeader('Access-Control-Allow-Origin','http://mydomain.com');
// or
res.setHeader('Access-Control-Allow-Origin','*');

Resources