GithubHelp home page GithubHelp logo

mahenrique94 / miniviewer Goto Github PK

View Code? Open in Web Editor NEW
25.0 4.0 11.0 89 KB

A minimalist Teamviewer

Home Page: https://miniviewer.netlify.com/

JavaScript 27.21% HTML 4.15% CSS 1.05% Vue 67.58%
vue vuejs peerjs webrtc netlify

miniviewer's Introduction

miniviewer

Netlify Status

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

miniviewer's People

Contributors

mahenrique94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

miniviewer's Issues

Cannot read property 'on' of undefined

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"

image

What's wrong with

    this.connection.on('open', () => {
      this.connection.on('data', newMessage => this.messages.push(newMessage))
    })

?

Looking forward to your kind help.
Marco

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.