🔧 Trying out some refactoring on socket connection to Import service

This commit is contained in:
2021-10-23 23:32:25 -07:00
parent d520f897de
commit 8fbea27fb2
5 changed files with 43 additions and 39 deletions

View File

@@ -2,13 +2,12 @@ import React from "react";
import { Link } from "react-router-dom";
const Navbar: React.FunctionComponent = (props) => {
return (
<nav className="navbar is-fixed-top">
<div className="navbar-brand">
<a className="navbar-item" href="http://bulma.io">
<img
src="threetwo.png"
src="public/threetwo.png"
alt="ThreeTwo! A comic book curator"
width="112"
height="28"

View File

@@ -39,6 +39,6 @@ export const IMPORT_SERVICE_BASE_URI = hostURIBuilder({
export const SOCKET_BASE_URI = hostURIBuilder({
protocol: "ws",
host: process.env.DOCKER_HOST || "localhost",
port: "8051",
port: "3001",
apiPath: ``,
});

View File

@@ -9,8 +9,8 @@ const WebSocketContext = createContext(null);
export const WebSocketProvider = ({ children }): ReactElement => {
const dispatch = useDispatch();
const socket: Socket = io(SOCKET_BASE_URI);
socket.on("connect", () => {
console.log("connected");
dispatch({
type: RMQ_SOCKET_CONNECTED,
isSocketConnected: true,
@@ -35,6 +35,7 @@ export const WebSocketProvider = ({ children }): ReactElement => {
console.log(`disconnect`);
});
socket.emit("bastard", { name: "puk" });
const ws: any = {
socket,
};