mirror of https://github.com/kern/filepizza
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
374 B
JavaScript
21 lines
374 B
JavaScript
import uuid from 'node-uuid'
|
|
import freeice from 'freeice'
|
|
|
|
const id = uuid.v4()
|
|
|
|
if (typeof window === 'undefined') {
|
|
var peer = { id: id }
|
|
} else {
|
|
let Peer = require('peerjs')
|
|
var peer = new Peer(id, {
|
|
host: window.location.hostname,
|
|
port: window.location.port,
|
|
path: '/peer',
|
|
config: {
|
|
iceServers: freeice()
|
|
}
|
|
})
|
|
}
|
|
|
|
export default peer
|