none
Need help in implementing Client Web Sockets using System.Net.WebSockets namespace RRS feed

  • Question

  • Dear All, 

    We are developing code for Web Socket Client side code using C#.Net. We are currently using CleintWebSocket class from System.Net.WebSockets namespace. We are using ConnectAsync function of the ClientWebSocket class to connect to the Server WebSocket. We need to call a callback function when the connection is established asynchronously using the ConnectAsync.

     We don’t know how to call our callback function, please guide us to fix the issue.

     Please do the needful.

     

    Thanks,

    Raghu Devisetti

    Saturday, November 11, 2017 1:31 PM

All replies

  • Hi Raghu Devisetti,

    Thank you for posting here.

    For your question, what is the callback function you want to call?

    ClientWebSocket.ConnectAsync Method will return a task. The returned Task object will complete after the connect request on the ClientWebSocket instance has completed. You could do the other things after you the return value task.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 13, 2017 6:28 AM
    Moderator
  • Thanks for your reply Wendy!

    Now I got how to proceed, will get back to you if i need some more information/clarification.

    Thanks, 

    Wednesday, November 15, 2017 12:44 PM
  • Hi Raghi Devisetti,

    Thank you for feedback.

    If you solved your problem, please mark the useful reply as answer. This will make answer searching in the forum and be beneficial to community members as well.

    If you have something else, welcome to post a new thread in this forum. We will try our best to help you.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, November 16, 2017 4:08 PM
    Moderator
  • Hi Raghu Devisetti,

    Is there any update? have you resolve the issue?

    Best regards,

    Zhanglong Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 28, 2017 8:12 AM
    Moderator