Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue #331 #943

Merged
merged 23 commits into from
Apr 12, 2016
Merged

Fix for Issue #331 #943

merged 23 commits into from
Apr 12, 2016

Conversation

zweihan
Copy link
Contributor

@zweihan zweihan commented Jan 31, 2016

Fixes #331.
Send query string over together with CONNECT packets.
Query associated with each socket is stored as a property of that socket.

@nkzawa
Copy link
Contributor

nkzawa commented Feb 12, 2016

We don't have style guide, but please follow existing styles like the following:

  • if( => if (
  • for() => for () {} if it's multi-line.

It would be nice to introduce eslint. cc @rauchg

var socket = io('/abc', {query: {a:'b'}}); //passes in as a query obj
var socket2 = io('/abcd?b=c&d=e'); //passes in as a query string
expect(socket.query).to.be('a=b');
expect(socket2.query).to.be('b=c&d=e');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice if we could test if query parameter was actually sent to server?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The corresponding PR on socket.io has the test that checks for the query parameter being sent over. Do you think that's ok?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it would be ok, thanks!

@zweihan zweihan force-pushed the queryStringFix branch 2 times, most recently from 324b5ef to 433366e Compare February 15, 2016 04:39
@@ -401,6 +401,7 @@ Manager.prototype.destroy = function(socket){
Manager.prototype.packet = function(packet){
debug('writing packet %j', packet);
var self = this;
if (packet.query && packet.type == 0) packet.nsp += '?' + packet.query;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder this packet can be { nsp: '/nsp', data:query }, so that we don't need to construct and parse query string.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think query can be in data rather than appending to nsp. Any thoughts about that ? cc @rauchg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's possible, but that would require changes to Socket.io but the corresponding PR has already been merged.

@nkzawa
Copy link
Contributor

nkzawa commented Apr 11, 2016

Thanks! Can you fix the conflict ?

* orgmaster: (44 commits)
  bump zuul
  Remove jspm browser config
  Run lint before test instead of before build
  ESlint manual fix
  Eslint autofix
  Add env to eslintrc
  Exclude generated files from linting
  updated babel-eslint dep to 4.1.7 (4.1.6 broken)
  refactor gulpfile
  Add eslint to gulpfile and create gulp task default
  fixed regex
  Rename gulp task webpack to build
  Remove commented make recipe
  removed babel react preset
  Makefile use gulp from node_modules instead of global
  Remove browserify stuff, add zuul-builder-webpack devDep
  Migrate zuul config from yml to js
  Refactor webpack config out to support/webpack.config.js
  removed ide-specific entries from gitignore
  updated makefile to use gulp commands
  ...

Conflicts:
	lib/manager.js
	lib/socket.js
@zweihan
Copy link
Contributor Author

zweihan commented Apr 12, 2016

@nkzawa Updated and fixed the conflict. Tests passed locally, including linting.

@rauchg rauchg merged commit 2802463 into socketio:master Apr 12, 2016
@rauchg
Copy link
Contributor

rauchg commented Apr 12, 2016

Thank you!

Nibbler999 pushed a commit to Nibbler999/socket.io-client that referenced this pull request Sep 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants