Browse Source

Merge pull request #25 from stakwork/single-socket

single socket
feature/dockerfile-arm
Evan Feenstra 5 years ago
committed by GitHub
parent
commit
58008f8135
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      api/utils/socket.ts
  2. 17
      dist/api/utils/socket.js
  3. 2
      dist/api/utils/socket.js.map
  4. 11
      dist/public/index.html
  5. 32444
      dist/public/js/app.js
  6. BIN
      dist/public/relay.jpg
  7. 372
      dist/public/semantic.min.css

18
api/utils/socket.ts

@ -1,7 +1,9 @@
import * as WebSocket from 'ws'
let connections = new Map()
let connectionCounter = 0
// let connections = new Map()
// let connectionCounter = 0
let lastConn: any
const connect = (server) => {
server = new WebSocket.Server({ server })
@ -10,16 +12,18 @@ const connect = (server) => {
server.on('connection', socket => {
console.log('=> [socket] connection received')
var id = connectionCounter++;
connections.set(id, socket)
// var id = connectionCounter++;
// connections.set(id, socket)
lastConn = socket
})
}
const send = (body) => {
connections.forEach((socket, index) => {
socket.send(body)
})
// connections.forEach((socket, index) => {
// socket.send(body)
// })
lastConn.send(body)
}
const sendJson = (object) => {

17
dist/api/utils/socket.js

@ -1,22 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const WebSocket = require("ws");
let connections = new Map();
let connectionCounter = 0;
// let connections = new Map()
// let connectionCounter = 0
let lastConn;
const connect = (server) => {
server = new WebSocket.Server({ server });
console.log('=> [socket] connected to server');
server.on('connection', socket => {
console.log('=> [socket] connection received');
var id = connectionCounter++;
connections.set(id, socket);
// var id = connectionCounter++;
// connections.set(id, socket)
lastConn = socket;
});
};
exports.connect = connect;
const send = (body) => {
connections.forEach((socket, index) => {
socket.send(body);
});
// connections.forEach((socket, index) => {
// socket.send(body)
// })
lastConn.send(body);
};
exports.send = send;
const sendJson = (object) => {

2
dist/api/utils/socket.js.map

@ -1 +1 @@
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../api/utils/socket.ts"],"names":[],"mappings":";;AAAA,gCAA+B;AAE/B,IAAI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,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE;QAC/B,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAA;QAC9C,gCAAgC;QAChC,8BAA8B;QAC9B,QAAQ,GAAG,MAAM,CAAA;IACnB,CAAC,CAAC,CAAA;AAEJ,CAAC,CAAA;AAcC,0BAAO;AAZT,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,EAAE;IACpB,2CAA2C;IAC3C,sBAAsB;IACtB,KAAK;IACL,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACrB,CAAC,CAAA;AAQC,oBAAI;AANN,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,EAAE;IAC1B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;AAC9B,CAAC,CAAA;AAKC,4BAAQ"}

11
dist/public/index.html

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>React app</title>
</head>
<body>
<div id="app"></div>
<script src="/static/js/app.js"></script>
<link href="/static/semantic.min.css" rel="stylesheet" />
</body>
</html>

32444
dist/public/js/app.js

File diff suppressed because one or more lines are too long

BIN
dist/public/relay.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

372
dist/public/semantic.min.css

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save