- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to use websocket client to connect wss://host:port/path server on Wiced 6.4
but it seems not support path in host, only support wss://host
Does Wiced not support it or I miss some setting in code?
Solved! Go to Solution.
- Labels:
-
WICED Studio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I printed out the result from the website you provided , I think they are using a not very strict define in their server:
server_response[HTTP/1.1 101 Switching Protocols
connection: Upgrade
date: Wed, 25 Mar 2020 10:44:08 GMT
sec-websocket-accept: EjO5jaXGHWBZKexAABC12S28=
server: Cowboy
upgrade: websocket
we have a lot of case sensitive settings in the fields, please modify below to have a try:
I already have a success to visit the server by using websocket_client:
#define HTTP_UPGRADE_CASE_SENSITIVE_TOKEN "Upgrade"
#define HTTP_UPGRADE_CASE_INSENSITIVE_TOKEN "WEBSOCKET"
#define HTTP_CONNECTION_CASE_SENSITIVE_TOKEN "connection: "
#define HTTP_CONNECTION_CASE_INSENSITIVE_TOKEN "UPGRADE"
#define HTTP_WEBSOCKET_ACCEPT_CASE_SENSITIVE_TOKEN "sec-websocket-accept: "
static const wiced_websocket_client_url_protocol_t websocket_header =
{
.request_uri = "/ws",
.host = "edengardentool.com", // connection to hosts with an ip-address(like internal servers) will also work.
//.host = "192.168.1.49",
.origin = "https://edengardentool.com",
//"https://edengardentool.com",
//"123.207.136.134",
.sec_websocket_protocol = NULL,
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just have a test by using websocket server and client:
in server we can set to :
.url = "wws://192.168.2.3/" ,
or
.url = "wws://192.168.2.3/chat"
client side is:
static const wiced_websocket_client_url_protocol_t websocket_header =
{
.request_uri = "/",
.host = "192.168.2.3", // connection to hosts with an ip-address(like internal servers) will also work.
//.host = "192.168.1.49",
.origin = "172.16.61.228",
.sec_websocket_protocol = NULL,
};
or
static const wiced_websocket_client_url_protocol_t websocket_header =
{
.request_uri = "/chat",
.host = "192.168.2.3", // connection to hosts with an ip-address(like internal servers) will also work.
//.host = "192.168.1.49",
.origin = "172.16.61.228",
.sec_websocket_protocol = NULL,
};
take this as a reference .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Zhengbao,
if server is like "wss://192.168.2.3:8443/ws"
I use the setting as below, but still failed to connect.
#define WEBSOCKET_SECURE_SERVER_STD_PORT (8443)
static const wiced_websocket_client_url_protocol_t websocket_header =
{
.request_uri = "/ws",
.host = "192.168.2.3", // connection to hosts with an ip-address(like internal servers) will also work.
//.host = "192.168.1.49",
.origin = "172.16.61.228",
.sec_websocket_protocol = NULL,
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I really need to have a study if wws can change the default port , so the default one is ok ?
I also have a test by using the open websocket test from internet, there has no option to let you change the port.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I printed out the result from the website you provided , I think they are using a not very strict define in their server:
server_response[HTTP/1.1 101 Switching Protocols
connection: Upgrade
date: Wed, 25 Mar 2020 10:44:08 GMT
sec-websocket-accept: EjO5jaXGHWBZKexAABC12S28=
server: Cowboy
upgrade: websocket
we have a lot of case sensitive settings in the fields, please modify below to have a try:
I already have a success to visit the server by using websocket_client:
#define HTTP_UPGRADE_CASE_SENSITIVE_TOKEN "Upgrade"
#define HTTP_UPGRADE_CASE_INSENSITIVE_TOKEN "WEBSOCKET"
#define HTTP_CONNECTION_CASE_SENSITIVE_TOKEN "connection: "
#define HTTP_CONNECTION_CASE_INSENSITIVE_TOKEN "UPGRADE"
#define HTTP_WEBSOCKET_ACCEPT_CASE_SENSITIVE_TOKEN "sec-websocket-accept: "
static const wiced_websocket_client_url_protocol_t websocket_header =
{
.request_uri = "/ws",
.host = "edengardentool.com", // connection to hosts with an ip-address(like internal servers) will also work.
//.host = "192.168.1.49",
.origin = "https://edengardentool.com",
//"https://edengardentool.com",
//"123.207.136.134",
.sec_websocket_protocol = NULL,
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content