Skip to content

Instantly share code, notes, and snippets.

View joshmarinacci's full-sized avatar
💭
energized

Josh Marinacci joshmarinacci

💭
energized
View GitHub Profile
@joshmarinacci
joshmarinacci / 1.html
Last active February 20, 2021 14:54 — forked from stephenlb/1.html
Enter Chat and press enter
<div><input id=input placeholder=you-chat-here /></div>
Chat Output
<div id=box></div>
<script src=https://cdn.pubnub.com/sdk/javascript/pubnub.4.0.11.min.js></script>
<script>(function(){
var pubnub = new PubNub({ publishKey : 'demo', subscribeKey : 'demo' });
function $(id) { return document.getElementById(id); }
pubnub.publish({
channel : 'mouseMoves',
message : {
x: 400,
y: 200
}
});
pubnub.subscribe({channels: [channel]});
pubnub.addListener({
presence: function(m){
document.getElementById('occupancy').textContent = m.occupancy;
}
});