mirror of
https://github.com/damouse/Drop64.git
synced 2024-05-31 18:27:58 -04:00
websocket messages aren't getting through on the router
This commit is contained in:
parent
c4533d3fad
commit
dcf25bf379
|
@ -23,10 +23,9 @@ angular.module('controller', [])
|
|||
var socket = io.connect($location.$$host + ':' + $location.$$port);
|
||||
$scope.counter = 0;
|
||||
|
||||
$scope.touchesStarted = function() {
|
||||
console.log("Touch Started");
|
||||
$scope.counter++;
|
||||
}
|
||||
socket.on('connect', function() {
|
||||
socket.emit('command', 'Controller Connected');
|
||||
});
|
||||
|
||||
|
||||
$scope.press = function(b, k) {
|
||||
|
|
|
@ -11,11 +11,11 @@ function makeKeyboardEvent(event, key, code) {
|
|||
// Start socket.io implementation
|
||||
var sock = io.connect(window.location.host);
|
||||
|
||||
sock.on('connect', () => {
|
||||
sock.emit('command', 'connected');
|
||||
sock.on('connect', function() {
|
||||
sock.emit('command', 'Display Connected');
|
||||
|
||||
// Turn each input key into a simulated browser keypress
|
||||
sock.on("input", (m) => {
|
||||
sock.on("input", function(m) {
|
||||
makeKeyboardEvent(m.event, m.button, m.code);
|
||||
})
|
||||
});
|
||||
|
|
|
@ -3,20 +3,18 @@ const app = express();
|
|||
var http = require('http').Server(app);
|
||||
var io = require('socket.io')(http);
|
||||
|
||||
app.get('/', (req, res) => { res.sendFile('display.html', { root: 'views' }) })
|
||||
app.get('/controller', (req, res) => { res.sendFile('controller.html', { root: 'views' }) })
|
||||
app.get('/', function(req, res) { res.sendFile('display.html', { root: 'views' }) })
|
||||
app.get('/controller', function(req, res) { res.sendFile('controller.html', { root: 'views' }) })
|
||||
|
||||
for (var d of["stylesheets", "vendor", "sensors", "src"]) {
|
||||
app.use('/assets', express.static(d));
|
||||
}
|
||||
for (var d of["stylesheets", "vendor", "sensors", "src"]) { app.use('/assets', express.static(d)) }
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
console.log("Connected");
|
||||
io.on('connection', function(socket) {
|
||||
socket.on("controller", function(m) {
|
||||
console.log(m);
|
||||
io.emit('input', m)
|
||||
});
|
||||
socket.on("command", function(m) {
|
||||
console.log(m);
|
||||
io.emit('command', m);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue