-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P2P not working in vue app #495
Comments
@gowram please point to a repo or a gist. No one will open a zip file. |
|
team, <script setup>
import { Peer } from 'socket:peer'
import { ref, onMounted } from 'vue'
onMounted(async () => {
const pair = await Peer.createKeys()
const clusterId = await Peer.createClusterId()
peer = new Peer({ ...pair, clusterId })
peer.join()
peer.on('greeting', (data, ppr, address, port) => {
clr.value = "color = " + data.color;
if (peer.peer.address !== ppr) {
console.log('remote on...')
}
setColor(data.color)
})
})
defineProps({
msg: String,
})
const count = ref(0)
let peer = ref("")
let ip = ref("loading....")
let clr = ref("black")
const setColor = c => document.body.style.backgroundColor = `#${c}`
function setBgColor() {
const color = Math.floor(Math.random() * 16777215).toString(16)
peer.emit('greeting', {
'color': color,
'timestamp': Date.now()
})
setColor(color);
ip.value = peer?.peer?.address
}
</script>
<template>
<h1>{{ msg }}</h1>
<h2>{{ ip }}</h2>
<h3>{{ clr }}</h3>
<div class="card">
<button type="button" @click="setBgColor">Change Color</button>
</div>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
</style>` |
Try using the same clusterId and key pair between devices that you want to connect. |
@RGBboy I tried with same clusterId and keypair between devices, Still it's not working.. peer.on itself not getting listened, if i use same clusterId and keypair. is there any documentation available? |
Just to add to this, also trying to set up a demo. Not using vue but in vanilla js I'm not seeing the Source code is at https://github.com/sheldonth/perchd/blob/main/src/index.js if anyone can help. Much appreciated. |
today's merge will add the fix to main branch |
@heapwolf is there any update on this issue? |
Was this fixed? |
not yet |
Vue js app with P2P not working..
i have build application with v0.3.3 with vue.js it is loading fine in both Desktop (ubuntu) and mobile but communication not happening between two devices.
I have uploaded my code for your review,
https://github.com/gowram/sscvue
@heapwolf please, let me know what is missing here....
The text was updated successfully, but these errors were encountered: