Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Embedded Web server with WebSockets

Status
Not open for further replies.

leolib2004

Junior Member level 3
Joined
Jan 27, 2012
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,556
Hi All,

I am working with the Atmel Xplained Ultra Board and its LWIP sample code. I would like to be able to exchange messages with a HTML5 app using WebSockets.

My idea is to modify the sample code to answer to the handshake and then, without closing the connection, exchange websockets messages directly there, within the already established connection.

Well, I have obtained the handshake request and correctly made the response (using SHA-1 and base64 as in https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers).
But, no tcp message is being sent to the browser by my board as a handshake response. I don't know why because the code is exactly as it works while serving a webpage. ( the library is pretty high level there and I can see the corresponding responses as strings before being sent but magically one is sent (the one asking for the html) but the websocket isn't.

I am also using Hercules to test this and I can see that if I ask for the website, I get it, but if I send a websocket handshake, the response does not show up.

What can it be? Is it something wrong with my reasoning?

PS: I could attach some code if it's needed
 

Finally, it worked. The problem was that I was using a pointer pointing to a local variable trying to fill it from another function. I don't really understand why it didn't work but I fix that and everything works now. My reasoning was fine too as everything works. Wasn't that bad to implement is you have a library that do the SHA-1 and the base64 encoding.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top