This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| render() { | |
| const { chatLog, options } = this.state; | |
| return ( | |
| <div className="App"> | |
| <LioWebRTC | |
| options={options} | |
| onReady={this.join} | |
| onCreatedPeer={this.handleCreatedPeer} | |
| onReceivedPeerData={this.handlePeerData} | |
| > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import './App.css'; | |
| import ChatBox from './ChatBox'; | |
| class App extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| chatLog: [] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .container { | |
| width: 500px; | |
| max-width: 100%; | |
| display: flex; | |
| flex-flow: column; | |
| margin: 10px auto; | |
| border-radius: 5px; | |
| padding: 0; | |
| background-color: #383838; | |
| border: 1px solid #333; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import './ChatBox.css'; | |
| class ChatBox extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| inputMsg: '' | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import './App.css'; | |
| import ChatBox from './ChatBox'; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <div className="App"> | |
| <ChatBox /> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| class ChatBox extends Component { | |
| render() { | |
| return ( | |
| <div> | |
| <p>Hello world!</p> | |
| </div> | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| join = (webrtc) => webrtc.joinRoom('my-p2p-app-demo'); | |
| handleCreatedPeer = (webrtc, peer) => { | |
| this.addChat(`Peer-${peer.id.substring(0, 5)} joined the room!`, ' ', true); | |
| } | |
| handlePeerData = (webrtc, type, payload, peer) => { | |
| switch(type) { | |
| case 'chat': | |
| this.addChat(`Peer-${peer.id.substring(0, 5)}`, payload); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import { LioWebRTC } from 'react-liowebrtc'; | |
| import './App.css'; | |
| import ChatBox from './ChatBox'; | |
| class App extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| chatLog: [], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| handleSend = (chatMsg) => { | |
| this.props.webrtc.shout('chat', chatMsg); | |
| this.props.onSend(chatMsg); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const vm = require('vm'); | |
| console.log(vm.runInNewContext('this.constructor.constructor("return process")().env')); |
OlderNewer