This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying my Blockstack ID is secured with the address 175xM6nf2JLq574JS5oRqFvWjgPFk5ByrG https://explorer.blockstack.org/address/175xM6nf2JLq574JS5oRqFvWjgPFk5ByrG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying my Blockstack ID is secured with the address 123JLFhUFdrg5R7ASLkGbFsB1ypGsz2rTc https://explorer.blockstack.org/address/123JLFhUFdrg5R7ASLkGbFsB1ypGsz2rTc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
"@babel/preset-env" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "msrouter", | |
"version": "1.0.0", | |
"description": "", | |
"main": "msRouter.js", | |
"scripts": { | |
"start": "nodemon --exec babel-node msRouter.js", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express") | |
const socketIO = require('socket.io'); | |
const http = require('http') | |
const pino = require('pino'); | |
require('dotenv').config(); | |
const LOGGER = pino({ level: process.env.LOG_LEVEL || 'info' }); | |
LOGGER.info("Starting server") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import socketIOClient from "socket.io-client"; | |
// link should be in environemnt file! | |
let socket = socketIOClient(process.env.REACT_APP_SOCKET_URL) | |
// component wrapper that allows us to use socket globaly | |
function withSocket (WrappedComponent) { | |
const WithSocket = props => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import logo from './logo.svg'; | |
import withSocket from "./withSocket" | |
import './App.css'; | |
function App({socketListen, socketSend}) { | |
socketSend("message", {name: "i am connected"}) | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rabbit = require('amqplib/callback_api'); | |
const pino = require('pino'); | |
require('dotenv').config(); | |
const LOGGER = pino({ level: process.env.LOG_LEVEL || 'info' }); | |
LOGGER.info(`Connecting to RabbitMQ`) | |
rabbit.connect('amqp://localhost', (error0, connection) => { | |
if (error0) { | |
throw error0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express") | |
const socketIO = require('socket.io'); | |
const http = require('http') | |
var rabbit = require('amqplib/callback_api'); | |
const pino = require('pino'); | |
require('dotenv').config(); | |
const LOGGER = pino({ level: process.env.LOG_LEVEL || 'info' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
io.on('connection', (socket)=>{ | |
LOGGER.debug(`New user connected ${socket.id}`) | |
socket.on("message", (data) => { | |
let event = JSON.parse(data) | |
LOGGER.debug(event) | |
event.socketId = socket.id | |
rabbit.channel.send("userLogin", event) | |
}) | |
}); |
OlderNewer