rpc
This commit is contained in:
1 parent
111f690482
commit
2c66c47163
14 files changed
+168
-58
No files matched your search
@@ -12,10 +12,12 @@ export enum Events {
|
||||
WantAdded = 'WantAdded',
|
||||
StartupSync = 'StartupSync',
|
||||
ListingsUpdated = 'ListingsUpdated',
|
||||
Connection = 'Connection',
|
||||
}
|
||||
|
||||
export default function createEvents(log: Log, pg: Pg, discogs, offers) {
|
||||
const events = new EventEmitter({ captureRejections: true });
|
||||
const connections = new Map();
|
||||
|
||||
async function populateListings(want: Want) {
|
||||
try {
|
||||
@@ -82,5 +84,9 @@ export default function createEvents(log: Log, pg: Pg, discogs, offers) {
|
||||
log.info('offers up to date');
|
||||
});
|
||||
|
||||
events.on(Events.Connection, async function onConnection({ ws, id }) {
|
||||
connections.set(id, ws);
|
||||
})
|
||||
|
||||
return events;
|
||||
}
|
||||
Reference in new issue
Block a user