Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Use interface-transport tests with a wss multiaddr #93

Open
vasco-santos opened this issue Sep 23, 2019 · 2 comments
Open

Use interface-transport tests with a wss multiaddr #93

vasco-santos opened this issue Sep 23, 2019 · 2 comments
Assignees
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature P2 Medium: Good to have, but can wait until someone steps up

Comments

@vasco-santos
Copy link
Member

For testing this module with a wss multiaddr we need to configure the server properly using a certificate.

const server = https.createServer({
  cert: fs.readFileSync('./test/fixtures/certificate.pem'),
  key: fs.readFileSync('./test/fixtures/key.pem')
})

ws.createListener({ server }, conn => pipe(conn, conn))

After this, and taking into consideration that we will use a self-signed certificate, we also need to provide the option rejectUnauthorized: false to the Websocket instantiation, through passing this option in the ws.dial() call.

The current version of interface-transport does not allow us to configure each test individually, which does not allow us to provide this configuration only if we are using a wss multiaddr, which is mandatory to get these multiaddr.

@vasco-santos vasco-santos added kind/enhancement A net-new feature or improvement to an existing feature help wanted Seeking public contribution on this issue exp/expert Having worked on the specific codebase is important P2 Medium: Good to have, but can wait until someone steps up labels Sep 23, 2019
@vasco-santos vasco-santos self-assigned this Sep 23, 2019
@vasco-santos
Copy link
Member Author

In the context of #92 , I created a test using wssoutside the interface-transport suite, but we should in the future use the interface-transport for this as well

@D4nte
Copy link

D4nte commented Apr 23, 2021

Is using an https server the only way to listen on a wss multiaddr?
I am currently using libp2p-websockets to create a listening node for some custom protocols, I only use libp2p at the moment and was wondering how I can listen on a wss multiaddr. Is there any documentation I could read?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature P2 Medium: Good to have, but can wait until someone steps up
Projects
None yet
Development

No branches or pull requests

2 participants