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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.