- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
I am trying to use the WICED's web socket API. I see that in the web socket library, the default port is set to port 80.
Also, I need some example apps for web socket.
Please help.
Thanks!
Regards,
Manish
- Labels:
-
Cloud
-
TCPIP
-
Web Services
- Tags:
- 43341
- web socket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I finally got some basic WebSocket Application up and running.
Before this, there are some changes that need to be done in the underlying WebSockets library.
In libraries/protocols/websocket/
(1) websocket.c: add the custom port that where the WebSocket server is listening to:
In function: static wiced_result_t websocket_connect( wiced_websocket_t* websocket, wiced_ip_address_t* address ), update the port:
result = wiced_tcp_connect( &websocket->socket, address, CUSTOM_SERVER_PORT, 10000 );
(2) web socket_handshake.c, add the port setting into the tcp stream:
/* < Host: ip1.ip2.ip3.ip4 >*/
wiced_tcp_stream_write( &stream, "Host: ", (uint16_t) strlen( "Host: " ) );
wiced_tcp_stream_write( &stream, websocket_header_fields->host, (uint16_t) strlen( websocket_header_fields->host ) );
wiced_tcp_stream_write( &stream, ":CUSTOM_SERVER_PORT", (uint16_t) strlen(":8080" ) );
wiced_tcp_stream_write( &stream, "\r\n", (uint16_t) strlen( "\r\n" ) );
Please remember to use the native web socket server not a socket.io wrapper upon web sockets running on your AWS.
I also added two more DNS servers 8.8.8.8 and 8.8.4.4 to get consistent success in DNS resolution.
Please find a minimal app attached. We hosted a sample web socket server on EC2. We also verified our app using the demo client hosted by web socket.org: See websocket.org Echo Test - Powered by Kaazing
Please change the WEBSOCKET_SERVER_IP_STRING to point to your EC2 IP address that hosts the web socket server. Also, I have currently hardcoded my server port into the web socket library. You can however, pass it along from the application to the library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Folks, the web socket library is broken and has not been fixed since 3.1.2 (almost over a year). Until that is fixed, this web socket client is useless.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Then can you please provide a sample application that would help ensure that the underlying WebSockets API is being used properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
i have trouble to run the attached code in the page. When i change
#define WEBSOCKET_SERVER_IP_STRING "ws://echo.websocket.org"
as the following then i assume that it will connect an echo server however, i have trouble to connect such a server. So what do you suggest for this issue. Do you suggest any solution related with this application.
Best Wishes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the port you are using ... I can try with this URL and see if this application works for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mkochhal i have tried to do what you have stated however there is nothing changed:
#define WEBSOCKET_SERVER_IP_STRING "echo.websocket.org"
#define WEBSOCKET_PORT 8080 //3000.
there is one more place maybe need to change which is
websocket_handshake_fields.request_uri = "ws://54.193.101.214/";//socket.io/?transport=polling&b64=1";
what do you suggest now.
The procedure i have applied is the following:
i have downloaded code and insert wiced folder
then i changed the required changes in websocket.c and other file.
then i changed server_ip_string
then i run the code check with real term.
see error:Websocket
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did anybody get this to work with the echo.websocket.org server?
Regards
Renejos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are interested to see how to do this with ZentriOS which is makes certain functions of WICED a little easier to use, I have published two tutorials in the 'Beginners guide to ZentriOS' blog.
The first is about focused on running a server on the device (Beginners guide to ZentriOS : Websockets (Server), the second is about running a client.
Hope it helps!