• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# JS API Changes of the Network Management Subsystem
2
3The table below lists the APIs changes of the network management subsystem in OpenHarmony 3.1 Release over OpenHarmony 3.0 LTS.
4
5## API Changes
6
7| Module| Class| Method/Attribute/Enumeration/Constant| Change Type|
8|---|---|---|---|
9| ohos.net.webSocket | WebSocket | off(type: 'error', callback?: ErrorCallback): void; | Added|
10| ohos.net.webSocket | WebSocket | on(type: 'error', callback: ErrorCallback): void; | Added|
11| ohos.net.webSocket | WebSocket | off(type: 'close', callback?: AsyncCallback\<{ code: number, reason: string }>): void; | Added|
12| ohos.net.webSocket | WebSocket | on(type: 'close', callback: AsyncCallback\<{ code: number, reason: string }>): void; | Added|
13| ohos.net.webSocket | WebSocket | off(type: 'message', callback?: AsyncCallback\<string \| ArrayBuffer>): void; | Added|
14| ohos.net.webSocket | WebSocket | on(type: 'message', callback: AsyncCallback\<string \| ArrayBuffer>): void; | Added|
15| ohos.net.webSocket | WebSocket | off(type: 'open', callback?: AsyncCallback\<Object>): void; | Added|
16| ohos.net.webSocket | WebSocket | on(type: 'open', callback: AsyncCallback\<Object>): void; | Added|
17| ohos.net.webSocket | WebSocket | close(callback: AsyncCallback\<boolean>): void;<br>close(options: WebSocketCloseOptions, callback: AsyncCallback\<boolean>): void;<br>close(options?: WebSocketCloseOptions): Promise\<boolean>; | Added|
18| ohos.net.webSocket | WebSocket | send(data: string \| ArrayBuffer, callback: AsyncCallback\<boolean>): void;<br>send(data: string \| ArrayBuffer): Promise\<boolean>; | Added|
19| ohos.net.webSocket | WebSocket | connect(url: string, callback: AsyncCallback\<boolean>): void;<br>connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback\<boolean>): void;<br>connect(url: string, options?: WebSocketRequestOptions): Promise\<boolean>; | Added|
20| ohos.net.webSocket | WebSocketCloseOptions | reason?: string; | Added|
21| ohos.net.webSocket | WebSocketCloseOptions | code?: number; | Added|
22| ohos.net.webSocket | WebSocketRequestOptions | header?: Object; | Added|
23| ohos.net.webSocket | webSocket | createWebSocket(): WebSocket; | Added|
24| ohos.net.socket | TCPSocket | off(type: 'error', callback?: ErrorCallback): void; | Added|
25| ohos.net.socket | TCPSocket | on(type: 'error', callback: ErrorCallback): void; | Added|
26| ohos.net.socket | TCPSocket | off(type: 'connect' \| 'close', callback?: Callback\<void>): void; | Added|
27| ohos.net.socket | TCPSocket | off(type: 'connect' \| 'close', callback?: Callback\<void>): void; | Added|
28| ohos.net.socket | TCPSocket | on(type: 'connect' \| 'close', callback: Callback\<void>): void; | Added|
29| ohos.net.socket | TCPSocket | on(type: 'connect' \| 'close', callback: Callback\<void>): void; | Added|
30| ohos.net.socket | TCPSocket | off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void; | Added|
31| ohos.net.socket | TCPSocket | on(type: 'message', callback: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void; | Added|
32| ohos.net.socket | TCPSocket | setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\<void>): void;<br>setExtraOptions(options: TCPExtraOptions): Promise\<void>; | Added|
33| ohos.net.socket | TCPSocket | getState(callback: AsyncCallback\<SocketStateBase>): void;<br>getState(): Promise\<SocketStateBase>; | Added|
34| ohos.net.socket | TCPSocket | getRemoteAddress(callback: AsyncCallback\<NetAddress>): void;<br>getRemoteAddress(): Promise\<NetAddress>; | Added|
35| ohos.net.socket | TCPSocket | close(callback: AsyncCallback\<void>): void;<br>close(): Promise\<void>; | Added|
36| ohos.net.socket | TCPSocket | send(options: TCPSendOptions, callback: AsyncCallback\<void>): void;<br>send(options: TCPSendOptions): Promise\<void>; | Added|
37| ohos.net.socket | TCPSocket | connect(options: TCPConnectOptions, callback: AsyncCallback\<void>): void;<br>connect(options: TCPConnectOptions): Promise\<void>; | Added|
38| ohos.net.socket | TCPSocket | bind(address: NetAddress, callback: AsyncCallback\<void>): void;<br>bind(address: NetAddress): Promise\<void>; | Added|
39| ohos.net.socket | TCPExtraOptions | socketLinger: {on: boolean, linger: number}; | Added|
40| ohos.net.socket | TCPExtraOptions | TCPNoDelay?: boolean; | Added|
41| ohos.net.socket | TCPExtraOptions | OOBInline?: boolean; | Added|
42| ohos.net.socket | TCPExtraOptions | keepAlive?: boolean; | Added|
43| ohos.net.socket | TCPSendOptions | encoding?: string; | Added|
44| ohos.net.socket | TCPSendOptions | data: string \| ArrayBuffer; | Added|
45| ohos.net.socket | TCPConnectOptions | timeout?: number; | Added|
46| ohos.net.socket | TCPConnectOptions | address: NetAddress; | Added|
47| ohos.net.socket | UDPSocket | off(type: 'error', callback?: ErrorCallback): void; | Added|
48| ohos.net.socket | UDPSocket | on(type: 'error', callback: ErrorCallback): void; | Added|
49| ohos.net.socket | UDPSocket | off(type: 'listening' \| 'close', callback?: Callback\<void>): void; | Added|
50| ohos.net.socket | UDPSocket | off(type: 'listening' \| 'close', callback?: Callback\<void>): void; | Added|
51| ohos.net.socket | UDPSocket | on(type: 'listening' \| 'close', callback: Callback\<void>): void; | Added|
52| ohos.net.socket | UDPSocket | on(type: 'listening' \| 'close', callback: Callback\<void>): void; | Added|
53| ohos.net.socket | UDPSocket | off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void; | Added|
54| ohos.net.socket | UDPSocket | on(type: 'message', callback: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void; | Added|
55| ohos.net.socket | UDPSocket | setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\<void>): void;<br>setExtraOptions(options: UDPExtraOptions): Promise\<void>; | Added|
56| ohos.net.socket | UDPSocket | getState(callback: AsyncCallback\<SocketStateBase>): void;<br>getState(): Promise\<SocketStateBase>; | Added|
57| ohos.net.socket | UDPSocket | close(callback: AsyncCallback\<void>): void;<br>close(): Promise\<void>; | Added|
58| ohos.net.socket | UDPSocket | send(options: UDPSendOptions, callback: AsyncCallback\<void>): void;<br>send(options: UDPSendOptions): Promise\<void>; | Added|
59| ohos.net.socket | UDPSocket | bind(address: NetAddress, callback: AsyncCallback\<void>): void;<br>bind(address: NetAddress): Promise\<void>; | Added|
60| ohos.net.socket | SocketRemoteInfo | size: number; | Added|
61| ohos.net.socket | SocketRemoteInfo | port: number; | Added|
62| ohos.net.socket | SocketRemoteInfo | family: 'IPv4' \| 'IPv6'; | Added|
63| ohos.net.socket | SocketRemoteInfo | address: string; | Added|
64| ohos.net.socket | SocketStateBase | isConnected: boolean; | Added|
65| ohos.net.socket | SocketStateBase | isClose: boolean; | Added|
66| ohos.net.socket | SocketStateBase | isBound: boolean; | Added|
67| ohos.net.socket | UDPExtraOptions | broadcast?: boolean; | Added|
68| ohos.net.socket | ExtraOptionsBase | socketTimeout?: number; | Added|
69| ohos.net.socket | ExtraOptionsBase | reuseAddress?: boolean; | Added|
70| ohos.net.socket | ExtraOptionsBase | sendBufferSize?: number; | Added|
71| ohos.net.socket | ExtraOptionsBase | receiveBufferSize?: number; | Added|
72| ohos.net.socket | UDPSendOptions | address: NetAddress; | Added|
73| ohos.net.socket | UDPSendOptions | data: string \| ArrayBuffer; | Added|
74| ohos.net.socket | socket | constructTCPSocketInstance(): TCPSocket; | Added|
75| ohos.net.socket | socket | constructUDPSocketInstance(): UDPSocket; | Added|
76| ohos.net.socket | socket | import NetAddress = connection.NetAddress; | Added|
77| ohos.net.http | HttpResponse | cookies: string; | Added|
78| ohos.net.http | HttpResponse | header: Object; | Added|
79| ohos.net.http | HttpResponse | responseCode: ResponseCode \| number; | Added|
80| ohos.net.http | HttpResponse | result: string \| Object \| ArrayBuffer; | Added|
81| ohos.net.http | ResponseCode | VERSION | Added|
82| ohos.net.http | ResponseCode | GATEWAY_TIMEOUT | Added|
83| ohos.net.http | ResponseCode | UNAVAILABLE | Added|
84| ohos.net.http | ResponseCode | BAD_GATEWAY | Added|
85| ohos.net.http | ResponseCode | NOT_IMPLEMENTED | Added|
86| ohos.net.http | ResponseCode | INTERNAL_ERROR = 500 | Added|
87| ohos.net.http | ResponseCode | UNSUPPORTED_TYPE | Added|
88| ohos.net.http | ResponseCode | REQ_TOO_LONG | Added|
89| ohos.net.http | ResponseCode | ENTITY_TOO_LARGE | Added|
90| ohos.net.http | ResponseCode | PRECON_FAILED | Added|
91| ohos.net.http | ResponseCode | LENGTH_REQUIRED | Added|
92| ohos.net.http | ResponseCode | GONE | Added|
93| ohos.net.http | ResponseCode | CONFLICT | Added|
94| ohos.net.http | ResponseCode | CLIENT_TIMEOUT | Added|
95| ohos.net.http | ResponseCode | PROXY_AUTH | Added|
96| ohos.net.http | ResponseCode | NOT_ACCEPTABLE | Added|
97| ohos.net.http | ResponseCode | BAD_METHOD | Added|
98| ohos.net.http | ResponseCode | NOT_FOUND | Added|
99| ohos.net.http | ResponseCode | FORBIDDEN | Added|
100| ohos.net.http | ResponseCode | PAYMENT_REQUIRED | Added|
101| ohos.net.http | ResponseCode | UNAUTHORIZED | Added|
102| ohos.net.http | ResponseCode | BAD_REQUEST = 400 | Added|
103| ohos.net.http | ResponseCode | USE_PROXY | Added|
104| ohos.net.http | ResponseCode | NOT_MODIFIED | Added|
105| ohos.net.http | ResponseCode | SEE_OTHER | Added|
106| ohos.net.http | ResponseCode | MOVED_TEMP | Added|
107| ohos.net.http | ResponseCode | MOVED_PERM | Added|
108| ohos.net.http | ResponseCode | MULT_CHOICE = 300 | Added|
109| ohos.net.http | ResponseCode | PARTIAL | Added|
110| ohos.net.http | ResponseCode | RESET | Added|
111| ohos.net.http | ResponseCode | NO_CONTENT | Added|
112| ohos.net.http | ResponseCode | NOT_AUTHORITATIVE | Added|
113| ohos.net.http | ResponseCode | ACCEPTED | Added|
114| ohos.net.http | ResponseCode | CREATED | Added|
115| ohos.net.http | ResponseCode | OK = 200 | Added|
116| ohos.net.http | RequestMethod | CONNECT = "CONNECT" | Added|
117| ohos.net.http | RequestMethod | TRACE = "TRACE" | Added|
118| ohos.net.http | RequestMethod | DELETE = "DELETE" | Added|
119| ohos.net.http | RequestMethod | PUT = "PUT" | Added|
120| ohos.net.http | RequestMethod | POST = "POST" | Added|
121| ohos.net.http | RequestMethod | HEAD = "HEAD" | Added|
122| ohos.net.http | RequestMethod | GET = "GET" | Added|
123| ohos.net.http | RequestMethod | OPTIONS = "OPTIONS" | Added|
124| ohos.net.http | HttpRequest | once(type: "headersReceive", callback: Callback\<Object>): void; | Added|
125| ohos.net.http | HttpRequest | off(type: "headersReceive", callback?: Callback\<Object>): void; | Added|
126| ohos.net.http | HttpRequest | on(type: "headersReceive", callback: Callback\<Object>): void; | Added|
127| ohos.net.http | HttpRequest | off(type: "headerReceive", callback?: AsyncCallback\<Object>): void; | Added|
128| ohos.net.http | HttpRequest | on(type: "headerReceive", callback: AsyncCallback\<Object>): void; | Added|
129| ohos.net.http | HttpRequest | destroy(): void; | Added|
130| ohos.net.http | HttpRequest | request(url: string, callback: AsyncCallback\<HttpResponse>): void;<br>request(url: string, options: HttpRequestOptions, callback: AsyncCallback\<HttpResponse>): void;<br>request(url: string, options?: HttpRequestOptions): Promise\<HttpResponse>; | Added|
131| ohos.net.http | HttpRequestOptions | connectTimeout?: number; | Added|
132| ohos.net.http | HttpRequestOptions | readTimeout?: number; | Added|
133| ohos.net.http | HttpRequestOptions | header?: Object; | Added|
134| ohos.net.http | HttpRequestOptions | extraData?: string \| Object \| ArrayBuffer; | Added|
135| ohos.net.http | HttpRequestOptions | method?: RequestMethod; | Added|
136| ohos.net.http | http | createHttp(): HttpRequest; | Added|
137| ohos.net.connection | NetAddress | port?: number; | Added|
138| ohos.net.connection | NetAddress | family?: number; | Added|
139| ohos.net.connection | NetAddress | address: string; | Added|
140| ohos.net.connection | LinkAddress | prefixLength: number; | Added|
141| ohos.net.connection | LinkAddress | address: NetAddress; | Added|
142| ohos.net.connection | RouteInfo | isDefaultRoute: boolean; | Added|
143| ohos.net.connection | RouteInfo | hasGateway: boolean; | Added|
144| ohos.net.connection | RouteInfo | gateway: NetAddress; | Added|
145| ohos.net.connection | RouteInfo | destination: LinkAddress; | Added|
146| ohos.net.connection | RouteInfo | interface: string; | Added|
147| ohos.net.connection | ConnectionProperties | mtu: number; | Added|
148| ohos.net.connection | ConnectionProperties | routes: Array\<RouteInfo>; | Added|
149| ohos.net.connection | ConnectionProperties | dnses: Array\<NetAddress>; | Added|
150| ohos.net.connection | ConnectionProperties | linkAddresses: Array\<LinkAddress>; | Added|
151| ohos.net.connection | ConnectionProperties | domains: string; | Added|
152| ohos.net.connection | ConnectionProperties | interfaceName: string; | Added|
153| ohos.net.connection | NetBearType | BEARER_ETHERNET = 3 | Added|
154| ohos.net.connection | NetBearType | BEARER_WIFI = 1 | Added|
155| ohos.net.connection | NetBearType | BEARER_CELLULAR = 0 | Added|
156| ohos.net.connection | NetCap | NET_CAPABILITY_VALIDATED = 16 | Added|
157| ohos.net.connection | NetCap | NET_CAPABILITY_NOT_VPN = 15 | Added|
158| ohos.net.connection | NetCap | NET_CAPABILITY_INTERNET = 12 | Added|
159| ohos.net.connection | NetCap | NET_CAPABILITY_NOT_METERED = 11 | Added|
160| ohos.net.connection | NetCap | NET_CAPABILITY_MMS = 0 | Added|
161| ohos.net.connection | NetCapabilities | bearerTypes: Array\<NetBearType>; | Added|
162| ohos.net.connection | NetCapabilities | networkCap?: Array\<NetCap>; | Added|
163| ohos.net.connection | NetCapabilities | linkDownBandwidthKbps?: number; | Added|
164| ohos.net.connection | NetCapabilities | linkUpBandwidthKbps?: number; | Added|
165| ohos.net.connection | NetHandle | getAddressByName(host: string, callback: AsyncCallback\<NetAddress>): void;<br>getAddressByName(host: string): Promise\<NetAddress>; | Added|
166| ohos.net.connection | NetHandle | getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>getAddressesByName(host: string): Promise\<Array\<NetAddress>>; | Added|
167| ohos.net.connection | NetHandle | netId: number; | Added|
168| ohos.net.connection | NetSpecifier | bearerPrivateIdentifier?: string; | Added|
169| ohos.net.connection | NetSpecifier | netCapabilities: NetCapabilities; | Added|
170| ohos.net.connection | NetConnection | unregister(callback: AsyncCallback\<void>): void; | Added|
171| ohos.net.connection | NetConnection | register(callback: AsyncCallback\<void>): void; | Added|
172| ohos.net.connection | NetConnection | on(type: 'netUnavailable', callback: Callback\<void>): void; | Added|
173| ohos.net.connection | NetConnection | on(type: 'netLost', callback: Callback\<NetHandle>): void; | Added|
174| ohos.net.connection | NetConnection | on(type: 'netConnectionPropertiesChange', callback: Callback\<{ netHandle: NetHandle, connectionProperties: ConnectionProperties }>): void; | Added|
175| ohos.net.connection | NetConnection | on(type: 'netCapabilitiesChange', callback: Callback\<{ netHandle: NetHandle, netCap: NetCapabilities }>): void; | Added|
176| ohos.net.connection | NetConnection | on(type: 'netBlockStatusChange', callback: Callback\<{ netHandle: NetHandle, blocked: boolean }>): void; | Added|
177| ohos.net.connection | NetConnection | on(type: 'netAvailable', callback: Callback\<NetHandle>): void; | Added|
178| ohos.net.connection | connection | getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>getAddressesByName(host: string): Promise\<Array\<NetAddress>>; | Added|
179| ohos.net.connection | connection | reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback\<void>): void;<br>reportNetDisconnected(netHandle: NetHandle): Promise\<void>; | Added|
180| ohos.net.connection | connection | reportNetConnected(netHandle: NetHandle, callback: AsyncCallback\<void>): void;<br>reportNetConnected(netHandle: NetHandle): Promise\<void>; | Added|
181| ohos.net.connection | connection | hasDefaultNet(callback: AsyncCallback\<boolean>): void;<br>hasDefaultNet(): Promise\<boolean>; | Added|
182| ohos.net.connection | connection | getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\<NetCapabilities>): void;<br>getNetCapabilities(netHandle: NetHandle): Promise\<NetCapabilities>; | Added|
183| ohos.net.connection | connection | getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\<ConnectionProperties>): void;<br>getConnectionProperties(netHandle: NetHandle): Promise\<ConnectionProperties>; | Added|
184| ohos.net.connection | connection | getAllNets(callback: AsyncCallback\<Array\<NetHandle>>): void;<br>getAllNets(): Promise\<Array\<NetHandle>>; | Added|
185| ohos.net.connection | connection | getDefaultNet(callback: AsyncCallback\<NetHandle>): void;<br>getDefaultNet(): Promise\<NetHandle>; | Added|
186| ohos.net.connection | connection | createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection; | Added|
187