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

Possible docs improvement: what browser socket receives #6

Closed
ifesdjeen opened this issue May 29, 2011 · 4 comments
Closed

Possible docs improvement: what browser socket receives #6

ifesdjeen opened this issue May 29, 2011 · 4 comments

Comments

@ifesdjeen
Copy link

It might be possibly good to add some examples of pushed data structures so that people could see what exactly browser receives. I expected pretty much the same thing that I've got, but I needed to test before I made sure everything's working just like that. If anyone's interested:

  <= Pusher['test'].trigger('string', 'test')
  => test

  <= Pusher['test'].trigger('hash', { :test => 'test' })
  => { test: "test" }

  <= Pusher['test'].trigger('hash', { 'test' => 'test', :test2 => test2 })
  => { test: "test", test2: "test2" }

  <= Pusher['test'].trigger('event', { :test => 0, :test_negative => -1, :test_boolean => true, :test_nil => nil })
  => { test: 0, test_boolean: true, test_negative: -1, test_nil: null }

  <= Pusher['test'].trigger('test_arrayarray', [ 0, 1, 2, 3 ])
  => [ 0, 1, 2, 3 ]

  <= Pusher['test'].trigger('mixed_array', [ 0, 'a', 2, 'c' ] )
  => [ 0, 'a', 2, 'a' ]

  <= Pusher['test'].trigger('array_of_arrays', [ ['a'], ['b'] ] )
  => [ [ 'a' ], [ 'b' ] ]

  <= Pusher['test'].trigger('array_of_hashes', [ { 'a' => 1 ], { 'b' => 2 } ] )
  => [ [ 'a': 1 ], [ 'b': 2 ] ]
@mloughran
Copy link
Contributor

Sorry nobody replied to this. I'm not sure what the confusion is though - either you pass as string which is already encoded as JSON, or it's encoded for you. Was that not clear?

@ifesdjeen
Copy link
Author

huh, well, by the time i first started using Pusher, it wasn't really clear, I just launched console, and started trying things by my own. most likely, it's just me)

By now we have used it for several months, so i understand what's going on there, so if you don't think there's no need to elaborate these things in docs, you can just close it. I just thought that it may be potentially useful for someone like me.

@mloughran
Copy link
Contributor

Thanks for the feedback - will keep this in mind :) Hope things are going well with Pusher.

@ifesdjeen
Copy link
Author

yep, sure, works smoothly :) thanks for great work!

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

No branches or pull requests

2 participants