github.com/hyperledger/aries-framework-go@v0.3.2/pkg/didcomm/transport/ws/upgrade_js_wasm.go (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package ws
     8  
     9  import (
    10  	"errors"
    11  	"net/http"
    12  	"time"
    13  
    14  	"nhooyr.io/websocket"
    15  )
    16  
    17  // Accept accepts a WebSocket handshake from a client and upgrades connection to a WebSocket.
    18  func Accept(_ http.ResponseWriter, _ *http.Request) (*websocket.Conn, error) {
    19  	return nil, errors.New("invalid operation with JS/WASM target")
    20  }
    21  
    22  func acceptRecipient(pool *connPool, keys []string) bool {
    23  	for _, v := range keys {
    24  		// check if the connection exists for the key
    25  		if c := pool.fetch(v); c != nil {
    26  			// TODO make sure connection is alive (conn.Ping() doesn't work with JS/WASM build)
    27  			return true
    28  		}
    29  	}
    30  
    31  	return false
    32  }
    33  
    34  func keepConnAlive(conn *websocket.Conn, outbound bool, frequency time.Duration) {
    35  	// TODO make sure connection is alive (conn.Ping() doesn't work with JS/WASM build)
    36  }