0

I'm currently implementing websocket communication betweeb the server (VB .NET) and the client(web page)

I succeeded in sending text from server to the client and display the text using JavaScript and canvas,

Now I want to send an image from the server to be displayed in the HTML5 canvas,

The websocket server implementation I use is Fleck

any suggestion? I lack binary/bmp knowledge

1 Answer 1

1

From a quick look at the Fleck source, you can send binary data using

string imgFilePath = ...
socket.send(System.IO.File.ReadAllBytes(imgFilePath));

(where socket will be a member variable you store in the OnOpen delegate of the IWebSocketConnection passed to your server's Start method)

Note that not all browsers support reading binary frames yet. Recent versions of Chrome support it; I'm not sure if any others do yet.

Sign up to request clarification or add additional context in comments.

2 Comments

Firefox 11 does supports binary opcode as well. developer.mozilla.org/en/Firefox_11_for_developers
I think it will work, do you know how to receive it at the client side(JavaScript)? I assume it's to convert the binary to image

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.