harmony(鸿蒙)JS API Changes of the Network Management Subsystem

2022-08-09 浏览 (727)

JS API Changes of the Network Management Subsystem

The table below lists the APIs changes of the network management subsystem in OpenHarmony 3.1 Release over OpenHarmony 3.0 LTS.

API Changes

ModuleClassMethod/Attribute/Enumeration/ConstantChange Type
ohos.net.webSocketWebSocketoff(type: 'error', callback?: ErrorCallback): void;Added
ohos.net.webSocketWebSocketon(type: 'error', callback: ErrorCallback): void;Added
ohos.net.webSocketWebSocketoff(type: 'close', callback?: AsyncCallback<{ code: number, reason: string }>): void;Added
ohos.net.webSocketWebSocketon(type: 'close', callback: AsyncCallback<{ code: number, reason: string }>): void;Added
ohos.net.webSocketWebSocketoff(type: 'message', callback?: AsyncCallback<string |ArrayBuffer>): void;Added
ohos.net.webSocketWebSocketon(type: 'message', callback: AsyncCallback<string |ArrayBuffer>): void;Added
ohos.net.webSocketWebSocketoff(type: 'open', callback?: AsyncCallback<Object>): void;Added
ohos.net.webSocketWebSocketon(type: 'open', callback: AsyncCallback<Object>): void;Added
ohos.net.webSocketWebSocketclose(callback: AsyncCallback<boolean>): void;
close(options: WebSocketCloseOptions, callback: AsyncCallback<boolean>): void;
close(options?: WebSocketCloseOptions): Promise<boolean>;
Added
ohos.net.webSocketWebSocketsend(data: string |ArrayBuffer, callback: AsyncCallback<boolean>): void;
send(data: string |ArrayBuffer): Promise<boolean>;
Added
ohos.net.webSocketWebSocketconnect(url: string, callback: AsyncCallback<boolean>): void;
connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback<boolean>): void;
connect(url: string, options?: WebSocketRequestOptions): Promise<boolean>;
Added
ohos.net.webSocketWebSocketCloseOptionsreason?: string;Added
ohos.net.webSocketWebSocketCloseOptionscode?: number;Added
ohos.net.webSocketWebSocketRequestOptionsheader?: Object;Added
ohos.net.webSocketwebSocketcreateWebSocket(): WebSocket;Added
ohos.net.socketTCPSocketoff(type: 'error', callback?: ErrorCallback): void;Added
ohos.net.socketTCPSocketon(type: 'error', callback: ErrorCallback): void;Added
ohos.net.socketTCPSocketoff(type: 'connect' |'close', callback?: Callback<void>): void;Added
ohos.net.socketTCPSocketoff(type: 'connect' |'close', callback?: Callback<void>): void;Added
ohos.net.socketTCPSocketon(type: 'connect' |'close', callback: Callback<void>): void;Added
ohos.net.socketTCPSocketon(type: 'connect' |'close', callback: Callback<void>): void;Added
ohos.net.socketTCPSocketoff(type: 'message', callback?: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void;Added
ohos.net.socketTCPSocketon(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void;Added
ohos.net.socketTCPSocketsetExtraOptions(options: TCPExtraOptions, callback: AsyncCallback<void>): void;
setExtraOptions(options: TCPExtraOptions): Promise<void>;
Added
ohos.net.socketTCPSocketgetState(callback: AsyncCallback<SocketStateBase>): void;
getState(): Promise<SocketStateBase>;
Added
ohos.net.socketTCPSocketgetRemoteAddress(callback: AsyncCallback<NetAddress>): void;
getRemoteAddress(): Promise<NetAddress>;
Added
ohos.net.socketTCPSocketclose(callback: AsyncCallback<void>): void;
close(): Promise<void>;
Added
ohos.net.socketTCPSocketsend(options: TCPSendOptions, callback: AsyncCallback<void>): void;
send(options: TCPSendOptions): Promise<void>;
Added
ohos.net.socketTCPSocketconnect(options: TCPConnectOptions, callback: AsyncCallback<void>): void;
connect(options: TCPConnectOptions): Promise<void>;
Added
ohos.net.socketTCPSocketbind(address: NetAddress, callback: AsyncCallback<void>): void;
bind(address: NetAddress): Promise<void>;
Added
ohos.net.socketTCPExtraOptionssocketLinger: {on: boolean, linger: number};Added
ohos.net.socketTCPExtraOptionsTCPNoDelay?: boolean;Added
ohos.net.socketTCPExtraOptionsOOBInline?: boolean;Added
ohos.net.socketTCPExtraOptionskeepAlive?: boolean;Added
ohos.net.socketTCPSendOptionsencoding?: string;Added
ohos.net.socketTCPSendOptionsdata: string |ArrayBuffer;Added
ohos.net.socketTCPConnectOptionstimeout?: number;Added
ohos.net.socketTCPConnectOptionsaddress: NetAddress;Added
ohos.net.socketUDPSocketoff(type: 'error', callback?: ErrorCallback): void;Added
ohos.net.socketUDPSocketon(type: 'error', callback: ErrorCallback): void;Added
ohos.net.socketUDPSocketoff(type: 'listening' |'close', callback?: Callback<void>): void;Added
ohos.net.socketUDPSocketoff(type: 'listening' |'close', callback?: Callback<void>): void;Added
ohos.net.socketUDPSocketon(type: 'listening' |'close', callback: Callback<void>): void;Added
ohos.net.socketUDPSocketon(type: 'listening' |'close', callback: Callback<void>): void;Added
ohos.net.socketUDPSocketoff(type: 'message', callback?: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void;Added
ohos.net.socketUDPSocketon(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void;Added
ohos.net.socketUDPSocketsetExtraOptions(options: UDPExtraOptions, callback: AsyncCallback<void>): void;
setExtraOptions(options: UDPExtraOptions): Promise<void>;
Added
ohos.net.socketUDPSocketgetState(callback: AsyncCallback<SocketStateBase>): void;
getState(): Promise<SocketStateBase>;
Added
ohos.net.socketUDPSocketclose(callback: AsyncCallback<void>): void;
close(): Promise<void>;
Added
ohos.net.socketUDPSocketsend(options: UDPSendOptions, callback: AsyncCallback<void>): void;
send(options: UDPSendOptions): Promise<void>;
Added
ohos.net.socketUDPSocketbind(address: NetAddress, callback: AsyncCallback<void>): void;
bind(address: NetAddress): Promise<void>;
Added
ohos.net.socketSocketRemoteInfosize: number;Added
ohos.net.socketSocketRemoteInfoport: number;Added
ohos.net.socketSocketRemoteInfofamily: 'IPv4' |'IPv6';Added
ohos.net.socketSocketRemoteInfoaddress: string;Added
ohos.net.socketSocketStateBaseisConnected: boolean;Added
ohos.net.socketSocketStateBaseisClose: boolean;Added
ohos.net.socketSocketStateBaseisBound: boolean;Added
ohos.net.socketUDPExtraOptionsbroadcast?: boolean;Added
ohos.net.socketExtraOptionsBasesocketTimeout?: number;Added
ohos.net.socketExtraOptionsBasereuseAddress?: boolean;Added
ohos.net.socketExtraOptionsBasesendBufferSize?: number;Added
ohos.net.socketExtraOptionsBasereceiveBufferSize?: number;Added
ohos.net.socketUDPSendOptionsaddress: NetAddress;Added
ohos.net.socketUDPSendOptionsdata: string |ArrayBuffer;Added
ohos.net.socketsocketconstructTCPSocketInstance(): TCPSocket;Added
ohos.net.socketsocketconstructUDPSocketInstance(): UDPSocket;Added
ohos.net.socketsocketimport NetAddress = connection.NetAddress;Added
ohos.net.httpHttpResponsecookies: string;Added
ohos.net.httpHttpResponseheader: Object;Added
ohos.net.httpHttpResponseresponseCode: ResponseCode |number;Added
ohos.net.httpHttpResponseresult: string |Object |ArrayBuffer;Added
ohos.net.httpResponseCodeVERSIONAdded
ohos.net.httpResponseCodeGATEWAY_TIMEOUTAdded
ohos.net.httpResponseCodeUNAVAILABLEAdded
ohos.net.httpResponseCodeBAD_GATEWAYAdded
ohos.net.httpResponseCodeNOT_IMPLEMENTEDAdded
ohos.net.httpResponseCodeINTERNAL_ERROR = 500Added
ohos.net.httpResponseCodeUNSUPPORTED_TYPEAdded
ohos.net.httpResponseCodeREQ_TOO_LONGAdded
ohos.net.httpResponseCodeENTITY_TOO_LARGEAdded
ohos.net.httpResponseCodePRECON_FAILEDAdded
ohos.net.httpResponseCodeLENGTH_REQUIREDAdded
ohos.net.httpResponseCodeGONEAdded
ohos.net.httpResponseCodeCONFLICTAdded
ohos.net.httpResponseCodeCLIENT_TIMEOUTAdded
ohos.net.httpResponseCodePROXY_AUTHAdded
ohos.net.httpResponseCodeNOT_ACCEPTABLEAdded
ohos.net.httpResponseCodeBAD_METHODAdded
ohos.net.httpResponseCodeNOT_FOUNDAdded
ohos.net.httpResponseCodeFORBIDDENAdded
ohos.net.httpResponseCodePAYMENT_REQUIREDAdded
ohos.net.httpResponseCodeUNAUTHORIZEDAdded
ohos.net.httpResponseCodeBAD_REQUEST = 400Added
ohos.net.httpResponseCodeUSE_PROXYAdded
ohos.net.httpResponseCodeNOT_MODIFIEDAdded
ohos.net.httpResponseCodeSEE_OTHERAdded
ohos.net.httpResponseCodeMOVED_TEMPAdded
ohos.net.httpResponseCodeMOVED_PERMAdded
ohos.net.httpResponseCodeMULT_CHOICE = 300Added
ohos.net.httpResponseCodePARTIALAdded
ohos.net.httpResponseCodeRESETAdded
ohos.net.httpResponseCodeNO_CONTENTAdded
ohos.net.httpResponseCodeNOT_AUTHORITATIVEAdded
ohos.net.httpResponseCodeACCEPTEDAdded
ohos.net.httpResponseCodeCREATEDAdded
ohos.net.httpResponseCodeOK = 200Added
ohos.net.httpRequestMethodCONNECT = "CONNECT"Added
ohos.net.httpRequestMethodTRACE = "TRACE"Added
ohos.net.httpRequestMethodDELETE = "DELETE"Added
ohos.net.httpRequestMethodPUT = "PUT"Added
ohos.net.httpRequestMethodPOST = "POST"Added
ohos.net.httpRequestMethodHEAD = "HEAD"Added
ohos.net.httpRequestMethodGET = "GET"Added
ohos.net.httpRequestMethodOPTIONS = "OPTIONS"Added
ohos.net.httpHttpRequestonce(type: "headersReceive", callback: Callback<Object>): void;Added
ohos.net.httpHttpRequestoff(type: "headersReceive", callback?: Callback<Object>): void;Added
ohos.net.httpHttpRequeston(type: "headersReceive", callback: Callback<Object>): void;Added
ohos.net.httpHttpRequestoff(type: "headerReceive", callback?: AsyncCallback<Object>): void;Added
ohos.net.httpHttpRequeston(type: "headerReceive", callback: AsyncCallback<Object>): void;Added
ohos.net.httpHttpRequestdestroy(): void;Added
ohos.net.httpHttpRequestrequest(url: string, callback: AsyncCallback<HttpResponse>): void;
request(url: string, options: HttpRequestOptions, callback: AsyncCallback<HttpResponse>): void;
request(url: string, options?: HttpRequestOptions): Promise<HttpResponse>;
Added
ohos.net.httpHttpRequestOptionsconnectTimeout?: number;Added
ohos.net.httpHttpRequestOptionsreadTimeout?: number;Added
ohos.net.httpHttpRequestOptionsheader?: Object;Added
ohos.net.httpHttpRequestOptionsextraData?: string |Object |ArrayBuffer;Added
ohos.net.httpHttpRequestOptionsmethod?: RequestMethod;Added
ohos.net.httphttpcreateHttp(): HttpRequest;Added
ohos.net.connectionNetAddressport?: number;Added
ohos.net.connectionNetAddressfamily?: number;Added
ohos.net.connectionNetAddressaddress: string;Added
ohos.net.connectionLinkAddressprefixLength: number;Added
ohos.net.connectionLinkAddressaddress: NetAddress;Added
ohos.net.connectionRouteInfoisDefaultRoute: boolean;Added
ohos.net.connectionRouteInfohasGateway: boolean;Added
ohos.net.connectionRouteInfogateway: NetAddress;Added
ohos.net.connectionRouteInfodestination: LinkAddress;Added
ohos.net.connectionRouteInfointerface: string;Added
ohos.net.connectionConnectionPropertiesmtu: number;Added
ohos.net.connectionConnectionPropertiesroutes: Array<RouteInfo>;Added
ohos.net.connectionConnectionPropertiesdnses: Array<NetAddress>;Added
ohos.net.connectionConnectionPropertieslinkAddresses: Array<LinkAddress>;Added
ohos.net.connectionConnectionPropertiesdomains: string;Added
ohos.net.connectionConnectionPropertiesinterfaceName: string;Added
ohos.net.connectionNetBearTypeBEARER_ETHERNET = 3Added
ohos.net.connectionNetBearTypeBEARER_WIFI = 1Added
ohos.net.connectionNetBearTypeBEARER_CELLULAR = 0Added
ohos.net.connectionNetCapNET_CAPABILITY_VALIDATED = 16Added
ohos.net.connectionNetCapNET_CAPABILITY_NOT_VPN = 15Added
ohos.net.connectionNetCapNET_CAPABILITY_INTERNET = 12Added
ohos.net.connectionNetCapNET_CAPABILITY_NOT_METERED = 11Added
ohos.net.connectionNetCapNET_CAPABILITY_MMS = 0Added
ohos.net.connectionNetCapabilitiesbearerTypes: Array<NetBearType>;Added
ohos.net.connectionNetCapabilitiesnetworkCap?: Array<NetCap>;Added
ohos.net.connectionNetCapabilitieslinkDownBandwidthKbps?: number;Added
ohos.net.connectionNetCapabilitieslinkUpBandwidthKbps?: number;Added
ohos.net.connectionNetHandlegetAddressByName(host: string, callback: AsyncCallback<NetAddress>): void;
getAddressByName(host: string): Promise<NetAddress>;
Added
ohos.net.connectionNetHandlegetAddressesByName(host: string, callback: AsyncCallback<Array<NetAddress>>): void;
getAddressesByName(host: string): Promise<Array<NetAddress>>;
Added
ohos.net.connectionNetHandlenetId: number;Added
ohos.net.connectionNetSpecifierbearerPrivateIdentifier?: string;Added
ohos.net.connectionNetSpecifiernetCapabilities: NetCapabilities;Added
ohos.net.connectionNetConnectionunregister(callback: AsyncCallback<void>): void;Added
ohos.net.connectionNetConnectionregister(callback: AsyncCallback<void>): void;Added
ohos.net.connectionNetConnectionon(type: 'netUnavailable', callback: Callback<void>): void;Added
ohos.net.connectionNetConnectionon(type: 'netLost', callback: Callback<NetHandle>): void;Added
ohos.net.connectionNetConnectionon(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHandle, connectionProperties: ConnectionProperties }>): void;Added
ohos.net.connectionNetConnectionon(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, netCap: NetCapabilities }>): void;Added
ohos.net.connectionNetConnectionon(type: 'netBlockStatusChange', callback: Callback<{ netHandle: NetHandle, blocked: boolean }>): void;Added
ohos.net.connectionNetConnectionon(type: 'netAvailable', callback: Callback<NetHandle>): void;Added
ohos.net.connectionconnectiongetAddressesByName(host: string, callback: AsyncCallback<Array<NetAddress>>): void;
getAddressesByName(host: string): Promise<Array<NetAddress>>;
Added
ohos.net.connectionconnectionreportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback<void>): void;
reportNetDisconnected(netHandle: NetHandle): Promise<void>;
Added
ohos.net.connectionconnectionreportNetConnected(netHandle: NetHandle, callback: AsyncCallback<void>): void;
reportNetConnected(netHandle: NetHandle): Promise<void>;
Added
ohos.net.connectionconnectionhasDefaultNet(callback: AsyncCallback<boolean>): void;
hasDefaultNet(): Promise<boolean>;
Added
ohos.net.connectionconnectiongetNetCapabilities(netHandle: NetHandle, callback: AsyncCallback<NetCapabilities>): void;
getNetCapabilities(netHandle: NetHandle): Promise<NetCapabilities>;
Added
ohos.net.connectionconnectiongetConnectionProperties(netHandle: NetHandle, callback: AsyncCallback<ConnectionProperties>): void;
getConnectionProperties(netHandle: NetHandle): Promise<ConnectionProperties>;
Added
ohos.net.connectionconnectiongetAllNets(callback: AsyncCallback<Array<NetHandle>>): void;
getAllNets(): Promise<Array<NetHandle>>;
Added
ohos.net.connectionconnectiongetDefaultNet(callback: AsyncCallback<NetHandle>): void;
getDefaultNet(): Promise<NetHandle>;
Added
ohos.net.connectionconnectioncreateNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection;Added

你可能感兴趣的鸿蒙文章

harmony(鸿蒙)Readme

harmony(鸿蒙)Updates (OpenHarmony 3.1 Beta -> OpenHarmony 3.1 Release)

harmony(鸿蒙)JS API Changes of the Ability Framework

harmony(鸿蒙)JS API Changes of the Accessibility Subsystem

harmony(鸿蒙)JS API Changes of the Account Subsystem

harmony(鸿蒙)JS API Changes of the ArkUI Development Framework

harmony(鸿蒙)JS API Changes of the Power Management Subsystem

harmony(鸿蒙)JS API Changes of the Bundle Management Framework

harmony(鸿蒙)JS API Changes of the Communication Subsystem

harmony(鸿蒙)JS API Changes of the Utils Subsystem

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/1c57a075173246a285dfe0a2a9dceaec