pull/638/head
yann300 4 years ago
parent c44eb3af26
commit d3e59eca81
  1. 6
      libs/remixd/src/websocket.ts

@ -1,6 +1,6 @@
import * as WS from 'ws'
import * as http from 'http'
import { WebsocketOpt, ServiceClient } from './types' // eslint-disable-line
import { WebsocketOpt, ServiceClient } from './types'
import { getDomain } from './utils'
import { createClient } from '@remixproject/plugin-ws'
export default class WebSocket {
@ -18,14 +18,14 @@ export default class WebSocket {
const loopback = '127.0.0.1'
this.server.listen(this.port, loopback, () => {
console.log((new Date()) + ' remixd is listening on ' + loopback + ':' + this.port + '')
console.log(`${new Date()} remixd is listening on ${loopback}:${this.port}`)
})
this.wsServer = new WS.Server({
server: this.server,
verifyClient: (info, done) => {
if (!originIsAllowed(info.origin, this)) {
done(false)
console.log((new Date()) + ' Connection from origin ' + info.origin + ' rejected.')
console.log(`${new Date()} connection from origin ${info.origin}`)
return
}
done(true)

Loading…
Cancel
Save