Skip to content

Commit

Permalink
editor look at 3000 for websockets
Browse files Browse the repository at this point in the history
  • Loading branch information
eyesore- committed Jan 14, 2017
1 parent f1198e5 commit f19b23b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<body>
<div id="app"></div>
<!-- Webpack build -->
<script src="/client/js/adapter.js"></script>
<script src="/client/dist/build.js"></script>
<script src="client/js/adapter.js"></script>
<script src="client/dist/build.js"></script>
</body>
</html>
18 changes: 11 additions & 7 deletions client/vue-components/main_content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="content-left">
<VideoComponent id="video" :wsRTC="wsRTC" :answer="answer"></VideoComponent>
<div class="word-count" v-if="count > 0">
<div class="doc-info" v-if="count > 0">
<div>{{ count }} words</div>
<div>{{ time }} read</div>
</div>
Expand All @@ -26,6 +26,9 @@
import VideoComponent from './video_component.vue'
import Utils from '../js/utils.js'
import {textStats, docSubscribe} from '../js/editor.js'
import sharedb from 'sharedb/lib/client'
import richText from 'rich-text'
import Quill from 'quill'
import Chance from 'chance'
export default {
Expand All @@ -35,14 +38,14 @@
this.URI = c !== undefined && /^\w{5}$/.test(c) ? c : chance.word({length: 5})
//create RTC websocket
this.wsRTC = new WebSocket(`wss:https://${window.location.host}/ws/${URI}rtc`);
this.wsRTC = new WebSocket(`wss:https://${window.location.host}/ws/${this.URI}rtc`);
// update URL display. I still think we can do this with router somehow :S
window.history.pushState(window.location.origin, '/', URI);
window.history.pushState(window.location.origin, '/', this.URI);
},
mounted() {
sharedb.types.register(richText.type)
let socket = new WebSocket(`ws:https://${window.location.host}`)
let socket = new WebSocket(`ws:https://${window.location.hostname}:3000/${this.URI}`)
const connection = new sharedb.Connection(socket)
// For testing reconnection
window.disconnect = function() {
Expand All @@ -52,7 +55,7 @@
let socket = new WebSocket(`ws:https://${window.location.host}`);
connection.bindToSocket(socket);
}
const doc = connection.get('docs', 'richtext');
const doc = connection.get('docs', this.URI);
this.quill = new Quill('#editor', {
placeholder: 'Filthy animals.',
theme: 'bubble'
Expand All @@ -73,7 +76,8 @@
channel: '',
count: 0,
time: '',
quill: ''
quill: '',
URI: ''
}
},
components: {
Expand Down Expand Up @@ -103,7 +107,7 @@
justify-content: center;
align-items: flex-end;
}
.word-count{
.doc-info{
font-size: 0.95em;
font-weight: 600;
margin: 0.75em;
Expand Down
2 changes: 1 addition & 1 deletion server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ startServer()

function startServer() {
const app = express();
app.use(express.static('./client'));
app.use(express.static(__dirname + '/../client'));
const server = http.createServer(app);

// Connects any incoming WebSocket connection to ShareDB
Expand Down

0 comments on commit f19b23b

Please sign in to comment.