locked
WebSocket vs Messagechannel RRS feed

  • Question

  • User527076549 posted

    hi,

    Can anyone tell me ,when to use what ? Given the following Scenario,

    even WebSockets does the same ,as mentioned in requirement ?

    TestCASE:

    You are developing an ASP.NET MVC application that provides instant messaging capabilities to
    customers.
    You have the following requirements:
    Messages must be able to be sent and received simultaneously.
    Latency and unnecessary header data must be eliminated.
    The application must comply with HTML5 standards.
    You need to design the application to meet the requirements.
    What should you do?

    Friday, October 4, 2019 11:20 AM

All replies

  • User409696431 posted

    Your question is not clear.

    You quoted something, but what is the context?  Are you quoting a test question or something?

    Saturday, October 5, 2019 5:57 AM
  • User527076549 posted

    TestCASE:

    You are developing an ASP.NET MVC application that provides instant messaging capabilities to
    customers.
    You have the following requirements:
    Messages must be able to be sent and received simultaneously.
    Latency and unnecessary header data must be eliminated.
    The application must comply with HTML5 standards.
    You need to design the application to meet the requirements.
    What should you do?

    this is the question from test,

    either you can implement application using websockets

    or

    using MessageChaneel.

    Answer they have mentioned is MessageChannel.

    So my doubt is even Websocket does the same,as mentioned in requirement, then in what scenario v have to use MessageChannel

    Sunday, October 6, 2019 5:38 AM
  • User61956409 posted

    Hi Amitha,

    So my doubt is even Websocket does the same,as mentioned in requirement, then in what scenario v have to use MessageChannel

    The Channel Messaging API allows two separate scripts running in different browsing contexts attached to the same document to communicate directly, passing messages between one another through two-way channels (or pipes) with a port at each end.

    You can know channel messaging concepts and usage from these documents:

    https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API#Channel_messaging_concepts_and_usage

    https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API/Using_channel_messaging

    Besides, this SO thread discussed about "difference between MessageChannel and WebSockets" , please refer to it.

    https://stackoverflow.com/questions/29620567/difference-between-messagechannel-and-websockets

    With Regards,

    Fei Han

    Monday, October 7, 2019 6:10 AM