🔧 Added a single import socket.io endpoint

This commit is contained in:
2022-04-25 20:08:07 -07:00
parent bb9dbc2e47
commit dc4767db27

View File

@@ -1,15 +1,10 @@
"use strict";
import {
Service,
ServiceBroker,
ServiceSchema
} from "moleculer";
import { Service, ServiceBroker, ServiceSchema } from "moleculer";
const SocketIOService = require("moleculer-io");
const redisAdapter = require("socket.io-redis");
const redisURL = new URL(process.env.REDIS_URI);
console.log(redisURL.hostname);
export default class SocketService extends Service {
// @ts-ignore
public constructor(
@@ -56,14 +51,19 @@ export default class SocketService extends Service {
{}
);
break;
case "LS_SINGLE_IMPORT":
console.log(data.data);
break;
}
}
},
},
},
},
options: {
adapter: redisAdapter({ host: redisURL.hostname, port: 6379 })
adapter: redisAdapter({
host: redisURL.hostname,
port: 6379,
}),
},
},
},
@@ -71,8 +71,10 @@ export default class SocketService extends Service {
actions: {},
methods: {},
async started() {
this.io.on("connection", (data) => console.log("socket.io server initialized."))
}
this.io.on("connection", (data) =>
console.log("socket.io server initialized.")
);
},
},
schema
)