Closed thompsonbill closed 10 years ago
this looks like expected behavior for browserchannel, which mounts the socket at /channel
by default and therefore communicates through /channel/test
and /channel/bind
If I modify the URL ShareJS generates, the header is back there again:
$ curl -D - http://192.168.1.5:7007/channel/test?VER=8\&MODE=init\&zx=2zfy3vvc003c\&t=1
HTTP/1.1 200 OK
Content-Type: text/plain
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
X-Content-Type-Options: nosniff
Access-Control-Allow-Origin: *
X-Accept: application/json; application/x-www-form-urlencoded
Date: Sat, 22 Feb 2014 00:47:43 GMT
Connection: keep-alive
Transfer-Encoding: chunked
ShareJS doesn't generate the URL. ShareJS doesn't care about how your client & server communicate.
That last URL is the correct channel that the browserchannel client should connect on, and the CORS header is right there. Whats the problem? What URL is the browser actually trying to access the server through?
Try configuring your client to use the correct URL, as per the docs:
var s = new BCSocket('http://192.168.1.5:7007/channel', options);
Ok, I changed it to that:
Uncaught TypeError: Object #
That was from Chrome console, this is what the server is saying:
Listening on http://localhost:7007/ s->c { a: 'init', protocol: 0, id: '528ab1771de523660ceca5d292776555' } c->s { a: 'sub', c: 'users', d: 'seph' } s->c { a: 'sub', error: [Error: failed to connect to [localhost:27017]], c: 'users', d: 'seph' }
Great, so you're connecting through browserchannel. I'm closing this issue.
It looks like you have a different problem - sharejs is trying to use a local mongodb database to store your data, and it can't connect to mongo.
Ah great. mongod won't start anymore. Thanks for your help.
Np.
@thompsonbill @josephg it seems I'm having the same issue, but only in production mode. Can any of you chime in as to how my DB could get created, messages/streams received, but no data being wrote? I can access mongo via CLI and the connection is made from my server.js
, however it does not write anything and then results in the following error:
Could not subscribe: [object Object]
Data is clearly sent on the server log output as { a: 'sub', b: 'test', c: 'blah' }
, but it just doesn't write.
This only seems to occur in production mode, so it could be some really wonky issue with my fresh server set up (I've tried a fresh install three times now; using Digital Ocean droplets to no avail). I've got redis AND mongo installed and I even tried to just localhost:27017 for mongo too.
I've followed every other documentation/posting/bit of advice everywhere here and even in the Google Groups too. I tried adding cors: '*'
etc. I don't get any CORS errors either, only this DB write issue.
I have a feeling someone might be able to give me some pointer as to why my DB won't write :+1:
Thanks many!
I fixed it, had to use a different DB/server setup for some reason, I think ports were messed up or something. Anyways deployed my app at https://draftling.com/?t=1396977386494#niftylettuce@gmail.com:1396977375401 /cc @thompsonbill @josephg @nornagon thx for awesome project
I'm really glad you fixed whatever the problem was. It would be great to leave a description somewhere of your fix, but this is not the right place for any of this.
Please file issues related to sharejs on the sharejs issue tracker, and please don't hijack existing issue threads to discuss unrelated problems.
@josephg Why did you post this then?... https://github.com/share/ShareJS/issues/293#issuecomment-35788129
@josephg My issue spawned from that one, and then I was led here, that's why I posted here, sorry if it confused you. Thanks and great project.
I understand. Its not your fault - @thompsonbill had additional issues that were unrelated to the original CORS problem we ended up discussing here. I should have insisted on moving the discussion back to the sharejs issue tracker during that discussion.
Continued from this issue: https://github.com/share/ShareJS/issues/293