/********************************************************************************
 * Copyright (c) 2018 Contributors to the Eclipse Foundation
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0, or the W3C Software Notice and
 * Document License (2015-05-13) which is available at
 * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document.
 *
 * SPDX-License-Identifier: EPL-2.0 OR W3C-20150513
 ********************************************************************************/ /**
 * WebSockets client
 */ import { ProtocolClient , Content } from "@node-wot/core" ; import { Form , SecurityScheme } from "@node-wot/td-tools" ; import { Subscription } from "rxjs/Subscription" ; export default class WebSocketClient implements ProtocolClient { constructor ( ) { } public toString ( ) { return `[WebSocketClient]` ; } public readResource ( form ) { return new Promise < Content > ( ( resolve , reject ) => { } ) ; } public writeResource ( form , content ) { return new Promise < void > ( ( resolve , reject ) => { } ) ; } public invokeResource ( form , content ? ) { return new Promise < Content > ( ( resolve , reject ) => { } ) ; } public unlinkResource ( form ) { return new Promise < void > ( ( resolve , reject ) => { } ) ; } public subscribeResource ( form , next , error ? , complete ? ) { return null ; } public async start ( ) { } public async stop ( ) { } public setSecurity ( metadata , credentials ? ) { if ( metadata === undefined || ! Array . isArray ( metadata ) || metadata . length === 0 ) { console . warn ( "[binding-websockets]" , `WebSocketClient received empty security metadata` ) ; return false ; } const security = metadata [ 0 ] ; console . debug ( "[binding-websockets]" , `WebSocketClient using security scheme '${ security . scheme }'` ) ; return true ; } }