corrections
This commit is contained in:
@ -9,19 +9,16 @@ export interface OSCMessage {
|
|||||||
export let outputSocket = new WebSocket("ws://localhost:3000");
|
export let outputSocket = new WebSocket("ws://localhost:3000");
|
||||||
export let inputSocket = new WebSocket("ws://localhost:3001");
|
export let inputSocket = new WebSocket("ws://localhost:3001");
|
||||||
|
|
||||||
// Queue of 1000 last messages
|
|
||||||
export let oscMessages : any[] = [];
|
export let oscMessages : any[] = [];
|
||||||
|
|
||||||
inputSocket.addEventListener('message', (event) => {
|
inputSocket.addEventListener('message', (event) => {
|
||||||
let data = JSON.parse(event.data);
|
let data = JSON.parse(event.data);
|
||||||
if (oscMessages.length > 1000) {
|
if (oscMessages.length >= 1000) {
|
||||||
oscMessages.shift();
|
oscMessages.shift();
|
||||||
}
|
}
|
||||||
oscMessages.push(data);
|
oscMessages.push(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
outputSocket.onopen = function (event) {
|
outputSocket.onopen = function (event) {
|
||||||
console.log("Connected to WebSocket Server");
|
console.log("Connected to WebSocket Server");
|
||||||
|
|||||||
Reference in New Issue
Block a user