A minimalist app to make call's, send messages and share screen.
Build with:
- Vue
- WebRTC
- PeerJS
- SASS
- PUG
Click to se a demo
Just have a fun.
Thanks
A minimalist Teamviewer
Home Page: https://miniviewer.netlify.com/
A minimalist app to make call's, send messages and share screen.
Build with:
Click to se a demo
Just have a fun.
Thanks
Hi!
in order to fully understand how to use peerjs with vuejs, I'm trying to replicate what you excellently you have done but without pug.
This my very easy Peerjs.vue:
<template>
<div>
<p>My Peer Id : {{ myPeerId }}</p>
<p>Remote Peer Id
<input v-model="remotePeerId">
</p>
<p button @click="connect()">Connect to my friend!</p>
<form>
<label>Message To Send:</label>
<input v-model="message" type="text">
</form>
<p button @click="sendMessage()">Send Message!</p>
<hr>
<div class="col-xs-12 col-sm-6">
<ul class="list-group">
<li class="list-group-item" v-for="message in messages">Message: {{ message }}</li>
</ul>
</div>
</div>
</template>
<script>
import Peer from 'peerjs';
export default {
data: () => ({
connection: null,
connecting: true,
message: '',
messages: [],
myPeer: null,
myPeerId: '',
remotePeerId: ''
}),
created() {
this.myPeerId = (Math.random() * 6 + Math.random()).toString(36).replace('.', '');
this.myPeer = new Peer({ key: 'lwjd5qra8257b9' })
this.myPeer.on('open', id => {
console.log('Connected at PeerJS server with success')
this.myPeerId = id;
this.connecting = false
})
this.myPeer.on('connection', con => {
this.connection = con
con.on('open', () => {
con.on('data', newMessage => this.messages.push(newMessage))
})
})
},
computed: {
},
methods: {
connect() {
if (this.remotePeerId.trim().length) {
this.connection = this.myPeer.connect(this.remotePeerId)
this.connection.on('open', () => {
this.connection.on('data', newMessage => this.messages.push(newMessage))
})
}
},
sendMessage() {
const newMessage = {
id: this.myPeerId,
message: this.message
}
if (this.connection) {
this.connection.send(newMessage)
}
this.messages.push(newMessage)
this.message = ''
}
},
filters: {
}
}
</script>
When clicking to "Connect to my friend!" I get "Error in v-on handler: "TypeError: Cannot read property 'on' of undefined"
What's wrong with
this.connection.on('open', () => {
this.connection.on('data', newMessage => this.messages.push(newMessage))
})
?
Looking forward to your kind help.
Marco
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.