locked
websocket with store apps

    Question

  • Just out of interest I'm trying to use websockets in store app to communicate data to my localhost server. My client will be the store app and will use WinRT way of websocket communication, i've the example connecting to websockets provided by MS samples.

    now my query is i want my server to a win32component (a dll application) that should receive messages from store app back and forth.

    Can someone please let me know if that's possible and how to achieve the same ?

    Thursday, January 23, 2014 5:41 PM

Answers

  • Network connections to localhost are blocked outside of debugging, so this won't work in production.

    --Rob

    Thursday, January 23, 2014 6:39 PM
    Owner
  • Simple question: if this is just for learning, why are you picking WebSockets?  The key advantages of websockets over StreamSocket and DatagramSocket are: websockets are compatible with the W3C websockets that ordinary HTML5 browsers implement and websockets can work in more network situations (e.g., with proxies).

    But neither of these applies to you.  In this case, you might as well just use plain sockets.

    We have some posters that walk through the more common network APIs; these might be useful for you.


    Network Developer Experience Team (Microsoft)

    Monday, January 27, 2014 7:07 PM
  • Again, the loopback restriction will block the Windows Store app and the desktop app from directly communicating.

    Beyond that, if you're talking to a desktop app rather than a web server then using plain stream or datagram sockets are better than using web sockets.

    --Rob

    Thursday, February 6, 2014 9:53 PM
    Owner

All replies

  • Network connections to localhost are blocked outside of debugging, so this won't work in production.

    --Rob

    Thursday, January 23, 2014 6:39 PM
    Owner
  • Yep right, this is not for production, just for learning, i've been trying this out. Can you please help ? I'm a beginner and have beef thinking if it would is possible to code my server part as a win32 dll component and could let my store client connect over websockets to localhost and listen on some port ?

    Thanks !!

    Thursday, January 23, 2014 6:45 PM
  • For help with writing your server component you should ask in a forum supporting that component type. I'm not sure if you're talking about a desktop app or a web service or something else, so I can't suggest a specific forum.

    --Rob

    Thursday, January 23, 2014 6:49 PM
    Owner
  • I'm referring to a desktop app here. All i want is to create a win32 component that will act as server and respond for the commands sent by the metro client.
    Thursday, January 23, 2014 6:58 PM
  • Desktop app development questions should to in the Windows Desktop Developmentforums.

    A quick search found WebSocket Protocol Component API .

    The Windows.Networking.Sockets classes can be used in a desktop app, but they support only client APIs and don't provide methods to receive an incoming connection.

    Thursday, January 23, 2014 7:06 PM
    Owner
  • Simple question: if this is just for learning, why are you picking WebSockets?  The key advantages of websockets over StreamSocket and DatagramSocket are: websockets are compatible with the W3C websockets that ordinary HTML5 browsers implement and websockets can work in more network situations (e.g., with proxies).

    But neither of these applies to you.  In this case, you might as well just use plain sockets.

    We have some posters that walk through the more common network APIs; these might be useful for you.


    Network Developer Experience Team (Microsoft)

    Monday, January 27, 2014 7:07 PM
  • Thanks. I was simply trying to establish communication between metro and desktop apps through websockets. This should be possible through stream/ datagram socket is it ?

    I mean would i able to use them to accomplish communication between metro and desktop through generic sockets as well ? 

    Sunday, February 2, 2014 1:24 PM
  • Again, the loopback restriction will block the Windows Store app and the desktop app from directly communicating.

    Beyond that, if you're talking to a desktop app rather than a web server then using plain stream or datagram sockets are better than using web sockets.

    --Rob

    Thursday, February 6, 2014 9:53 PM
    Owner