fix: use empty array for ws protocols instead of null (#2140)

This commit is contained in:
tobi 2022-05-06 17:03:49 +02:00 committed by GitHub
parent b2d900f078
commit b312b3b485
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,7 +8,7 @@ export class WebSocketClient {
* @param protocols DOMString|DOMString[] Either a single protocol string or an array of protocol strings. These strings are used to indicate sub-protocols, so that a single server can implement multiple WebSocket sub-protocols (for example, you might want one server to be able to handle different types of interactions depending on the specified protocol). If you don't specify a protocol string, an empty string is assumed. * @param protocols DOMString|DOMString[] Either a single protocol string or an array of protocol strings. These strings are used to indicate sub-protocols, so that a single server can implement multiple WebSocket sub-protocols (for example, you might want one server to be able to handle different types of interactions depending on the specified protocol). If you don't specify a protocol string, an empty string is assumed.
* @param options options * @param options options
*/ */
constructor (url, protocols = null, options = {}) { constructor (url, protocols = [], options = {}) {
this.url = url this.url = url
this.protocols = protocols this.protocols = protocols