ambelovsky / gosf

Go SocketIO API Framework

Home Page:http://gosf.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add CORS to socket path

chatupol-int opened this issue · comments

can i config CORS??
I'm a newbie for golang.

#3

Please click the link above and let me know if this solves your issue.

sorry,that not work for me,because my socket domain run on differrent with socket caller and my socket is http.
I'm not good at English.

in your client code (socket caller), make sure you've specified that your client will only communicate over a web socket transport.

socket = io.connect(socketUri, { transports: ['websocket'] });

Cannot use http — must use the websocket transport so that your connection does not have to upgrade from http to websocket.

thanks,
my socket is on heroku cloud,can you tell me to upgrade http to socket.

Download the sample project: https://github.com/ambelovsky/gosf-sample-app

. ./scripts/getdeps.sh
. ./scripts/run.sh

Modify scaffolding.html on line 15:
var socketUri = 'ws://localhost:9990';

Replace "localhost" with your Heroku server IP address.