Study notes of WebSocket learning cocoscreator Contact

Source: Internet
Author: User

WebSocket Object provides a set of APIs for creating and managing WebSocket connections, and for sending and receiving data over that connection.

The WebSocket constructor method accepts a required parameter and an optional parameter:

WebSocket WebSocket (in domstring URL, in optional domstring protocols); WebSocket WebSocket (in domstring url,in Optional domstring[] protocols);

Represents the URL to connect to. This URL should be in response to the WebSocket address.
    protocols options available
can be a single protocol name string or an array that contains multiple protocol moniker strings. These strings are used to represent sub-protocols, which allows a server to implement multiple WebSocket sub-protocols (for example, you might want to handle different types of interactions by developing different protocols). If this parameter is not set, it is set to an empty string by default.

The constructor method may throw the following exception:

The port you are trying to connect to is masked.
Method Overview
void Close (in optional unsigned long code, in optional domstring reason); void Send (in domstring data); Properties

Reference article link:

Study notes of WebSocket learning cocoscreator Contact

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.