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
base: master
from

Conversation

Projects
None yet
2 participants
@ohenley
Contributor

ohenley commented Feb 17, 2013

The send method for strings does not work.

Update source/vibe/http/websockets.d
The Send method for strings didn't work.
@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Feb 18, 2013

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.

Member

s-ludwig commented Feb 18, 2013

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

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Feb 20, 2013

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?

Member

s-ludwig commented Feb 20, 2013

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

This comment has been minimized.

Show comment
Hide comment
@ohenley

ohenley Feb 28, 2013

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Feb 28, 2013

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).

Member

s-ludwig commented Feb 28, 2013

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