Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

UWP example: WebSocket

26.06.2018 (👁6816)


 

# WebSocket sample

Shows how to send and receive data using the WebSocket classes in the [Windows.Networking.Sockets](

http://msdn.microsoft.com/library/windows/apps/br226960)
namespace.
 

 

 

UTF8 example

This scenario uses a MessageWebSocket to send UTF-8 strings.

The sample server supports both plaintext WebSocket (ws: //) and secure WebSocket (wss: //) server endpoints.

 

Scenario2 Binary:

This scenario shows how to use a StreamWebSocket to send binary data.

The sample server supports Both plain text WebSocket (ws: //) and secure WebSocket (wss: //) server endpoints.

 

This scenario shows how to use a StreamWebSocket with a client certificate to connect to a server.

                The sample server (localhost) requires a secure WebSocket (wss: //) connection with a client certificate.

                The StreamWebSocket client certificate property behaves the same as the MessageWebSocket client certificate property.

 

 

This scenario uses a MessageWebSocket to send partial or complete messages.

                The sample server supports both plaintext WebSocket (ws: //) and secure WebSocket (wss: //) server endpoints.

 

 

[Lnk "http://msdn.microsoft.com/library/windows/apps/br226960" /]

Windows.Networking.Sockets namespace

Provides sockets and WebSockets classes for use in network communication and classes for real-time network alerts received in the background for Windows Store apps.

 

 

 

[Lnk "https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/WebSocket" /]

How to send and receive data using the WebSocket classes in the Windows.Networking.Sockets namespace.

 

The sample demonstrates the following:

 

Making a WebSocket connection, sending and receiving data, and closing the connection.

Handling both trusted (hard-coded) URI inputs and unvalidated (user-entered) URI inputs.

Accessing the server certificate information and performing custom validation (if needed) when using a secure Websocket (wss: //) endpoint.

Providing a custom client certificate when using a secure Websocket connection.