Search code examples
c#windows-store-apps

Sending raw data to Windows store app without Azure


I want to build a chat application but I don't want to use WNS because WNS required a visa card. Is there any way to send and receive raw data to Windows store app without WNS?

I found Push Notifications without Azure service? but it is MPNS for Windows phone, not for windows store app.


Solution

  • Is there any way to send and receive raw data to Windows store app without WNS?

    You can send and receive raw data by establishing socket connection between your application and server and handle the information in foreground or background task.

    To know how to use stream socket to send and receive data , please see StreamSocket Sample on GitHub.

    Moreover, you can use SocketAcitivityTrigger class to register a background task to notify the socket broker when your app is not active. For the complete sample , please refer to SocketActivityStreamSocket sample, which requires the capability Private Networks (Client & Server). And if your app uses socket activity triggers, you must specify the User Notification Listener capability in the app manifest. enter image description here

    The sample consists of SocketActivityStreamSocket (for client side) and StreamSocketListenerServer (for server side), please note the sample scenario will not work if both apps are testing on the same machine. Be sure to run the apps on separate machine so that they can communicate with each other.