Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript, multiple connections #3456

Closed
ghost opened this issue Mar 16, 2017 · 2 comments
Closed

Typescript, multiple connections #3456

ghost opened this issue Mar 16, 2017 · 2 comments
Assignees
Labels
non issue Issue is not a problem or requires changes

Comments

@ghost
Copy link

ghost commented Mar 16, 2017

Ahoi!

My code:

import * as Hapi from 'hapi';
import * as http from 'http';
import * as http2 from 'http2';

const Server: Hapi.Server = new Hapi.Server();

Server.connection([{
    listener: http.createServer(),
    port: 80,
    labels: ['http'],
    tls: false
}, {
    listener: http2.createServer({
        pfx: readFileSync('./dist/certificate.pfx')
    }),
    port: 443,
    labels: ['http2'],
    tls: true
}]);

Now i wanted to connect a websocket server to my hapi server, so i selected the http2 label:

const http2Server = Server.select('http2');
// now the websocket
import * as Websocket from 'ws';

const wss: Websocket.Server = new Websocket.Server(http2Server.listener);

at the http2Server.listener i'm getting an error: Property 'listener' does not exist on type 'Server[]'.

Everything is for sure working fine since the listener exists :)

Just wanted to tell that there is a small bug \o/

@corbinu
Copy link

corbinu commented Mar 16, 2017

@jerome724 The hapi TS definitions are not maintained by the hapi team. You would need to fix the file https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/hapi

@ghost
Copy link
Author

ghost commented Mar 17, 2017

Oh okay, i'll give it a try. Thanks!

@ghost ghost closed this as completed Mar 17, 2017
@Marsup Marsup added the non issue Issue is not a problem or requires changes label Mar 17, 2017
@Marsup Marsup self-assigned this Mar 17, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
non issue Issue is not a problem or requires changes
Projects
None yet
Development

No branches or pull requests

2 participants