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

Update source/vibe/http/websockets.d #182

Closed
wants to merge 1 commit into from
Closed

Update source/vibe/http/websockets.d #182

wants to merge 1 commit into from

Conversation

ohenley
Copy link
Contributor

@ohenley ohenley commented Feb 17, 2013

The send method for strings does not work.

The Send method for strings didn't work.
@s-ludwig
Copy link
Member

I just tested and it works for me. On the JavaScript side I get the string with message.data inside of the onmessage callback. Sending with send(cast(ubyte[]) in turn makes message.data a binary Blob. I've tested on Firefox 18, Opera 12.14 and Iron/Chrome 23.

@s-ludwig
Copy link
Member

I meant that the current version works me. With the change here, a string would be sent as binary data instead of as text, which is not the intention. Can you try to see again what exactly goes wrong in your tests?

@ohenley
Copy link
Contributor Author

ohenley commented Feb 28, 2013

Yes it works. I got confused by the sample code at http://vibed.org/api/vibe.http.websockets/. The part

auto msg = sock.receive();
sock.send(msg);

sends back a binary blob. I did the code on the client side to handle that blob (FileReader object etc) and then when I changed msg for a string, that same javascript code wasn't appropriate to handle a string (well if I remember this is what happened).

Sorry for the false positive.

@s-ludwig
Copy link
Member

I see. Lets just keep this open then until the example is fixed (I think it should send back the same type of message that it received).

@s-ludwig s-ludwig closed this in 7911d20 Mar 15, 2013
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.

2 participants