SecureWebSocket
Secure web socket client
client := SecureWebSocket->New(Url->New("wss://echo.websocket.org"));
if(client->Connect()) {
client->ReadSocketText()->PrintLine();
client->WriteTextSocket("Hello World!");
client->ReadSocketText()->PrintLine();
client->CloseSocket();
};
Operations
- New
- AddHeader
- CloseSocket
- Connect
- EnableCookies
- GetCookies
- GetIssuer
- GetStatusCode
- GetStatusMessage
- GetSubject
- PingSocket
- ReadSocketBinary
- ReadSocketText
- RemoveHeader
- WriteSocket
AddHeader
Adds a HTTPS request header
method : public : AddHeader(name:String, value:String) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
name | String | header name |
value | String | header value |
CloseSocket
Closes the web socket connection
method : public : CloseSocket(reason:Int) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
reason | Int | reason to close socket |
Connect
Opens a connection to a web socket
method : public : Connect() ~ Bool
Return
Type | Description |
---|---|
Bool | true if connected, false otherwise |
EnableCookies
Sets cookie support
method : public : EnableCookies(cookies_enabled:Bool) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
cookies_enabled | Bool | true if cookies are enabled, false otherwise |
GetCookies
Gets the cookies
method : public : GetCookies() ~ Vector<Cookie>
Return
Type | Description |
---|---|
Vector<Cookie> | vector of cookies |
GetIssuer
Gets the socket's X.509 certificate issuer name
method : public : GetIssuer() ~ String
Return
Type | Description |
---|---|
String | certificate issuer name |
GetStatusCode
Gets the last status code
method : public : GetStatusCode() ~ Int
Return
Type | Description |
---|---|
Int | last status code |
GetStatusMessage
Gets the last status message
method : public : GetStatusMessage() ~ String
Return
Type | Description |
---|---|
String | last status message |
GetSubject
Gets the socket's X.509 certificate subject name
method : public : GetSubject() ~ String
Return
Type | Description |
---|---|
String | certificate subject name |
New
Constructor
New(url:Web.HTTP.Url, cookies_enabled:Bool)
Parameters
Name | Type | Description |
---|---|---|
url | Web.HTTP.Url | URL |
cookies_enabled | Bool | true if cookies are enabled, false otherwise |
PingSocket
Pings the websocket server
method : public : PingSocket() ~ Bool
Return
Type | Description |
---|---|
Bool | true if pinged, false otherwise |
ReadSocketBinary
Reads binary input from the web socket
method : public : ReadSocketBinary() ~ Byte[]
Return
Type | Description |
---|---|
Byte | binary input read, Nil otherwise |
ReadSocketText
Reads text from the web socket
method : public : ReadSocketText() ~ String
Return
Type | Description |
---|---|
String | text read, Nil otherwise |
RemoveHeader
Removes a HTTPS request header
method : public : RemoveHeader(name:String) ~ Nil
Parameters
Name | Type | Description |
---|---|---|
name | String | header name |