newclient

This commit is contained in:
Nour Alharithi
2023-10-26 08:25:17 -07:00
parent 7181912607
commit e047def3a6
4 changed files with 23 additions and 6 deletions

2
.gitignore vendored
View File

@@ -141,3 +141,5 @@ src/**.js.map
.env
lib
src/playground.ts
dump.rdb

View File

@@ -0,0 +1,17 @@
import { io } from 'socket.io-client';
const main = async () => {
const socket = io('http://localhost:3000');
socket.on('connect', () => {
socket.emit('subscribe', 'SOL-PERP');
});
socket.on('SOL-PERP', (data: any) => {
console.log(data);
});
};
main().then(() => {
console.log('running');
});

View File

@@ -86,12 +86,11 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
}
if (
l2Args.updateOnChange &&
this.lastSeenL2Formatted
.get(l2Args.marketType)
?.get(l2Args.marketIndex) === JSON.stringify(l2Formatted)
l2Args.updateOnChange
) {
return;
if (this.lastSeenL2Formatted
.get(l2Args.marketType)
?.get(l2Args.marketIndex) === JSON.stringify(l2Formatted)) return;
}
this.lastSeenL2Formatted
.get(l2Args.marketType)

View File

@@ -23,7 +23,6 @@ async function main() {
console.log('Subscribing to channel', channel);
redisClient.client.subscribe(channel);
redisClient.client.on('message', (subscribedChannel, message) => {
console.log(message);
if (subscribedChannel === channel) {
socket.emit(channel, JSON.parse(message));
}