Skip to content

Commit

Permalink
use websocket on port instead of path
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Sep 14, 2017
1 parent baba6a2 commit c25bdd6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 8 additions & 2 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ require('dotenv').config()
const express = require('express')
const app = express()
const body = require('body-parser')
const PeerServer = require('peer').PeerServer
const {PeerServer} = require('peer')
const {readFileSync} = require('fs')

const port = process.env.API_PORT
const peerPort = process.env.PEER_PORT
Expand All @@ -14,8 +15,13 @@ if (!port || !peerPort) {

const peers = {}
const peerServer = PeerServer({
host: process.env.HOST,
path: '/',
port: peerPort,
proxied: true
ssl: {
cert: readFileSync(process.env.CERT_PATH),
key: readFileSync(process.env.KEY_PATH)
}
})

const channels = {
Expand Down
5 changes: 2 additions & 3 deletions client/src/containers/Toad.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ class Toad extends Component {
const {channel} = this.state
this.peer = new Peer({
host: '/',
path: '/_peer',
port: 443,
secure: true
secure: true,
port: window._env.PEER_PORT
})

this.connections = []
Expand Down

0 comments on commit c25bdd6

Please sign in to comment.