Subscribe to a Redis Server through VueJS - node.js

I am currently working on an application with the current tech stack:
Backend:
Mongoose
Express
Apollo
GraphQL
Frontend:
Vuejs
Apollo
GraphQL
So since I am a beginner with GraphQL I had no idea that apollo's inbuilt subscribe PubSub cannot be used in production and has no method of scaling without using services like Redis.
That being said, I have started a local Redis server for testing it, I managed to start a Redis Client in the backend using ioredis and it connects fine to the Redis server. I have now a problem that I can't start this up on my Vue frontend in order to receive messages being published by my backend. The creator of ioredis suggested that it is only for backends and I should use something else for the frontend.
I am currently confused as to how should I go about listening or subscribing to the redis server from my Vue frontend so I can receive published messages? Maybe I am looking at this in the wrong way? Any help would be appreciated.
Note: I have already done this with apollo/graphql's inbuilt subscribe but like mentioned, it can't be scaled.

Related

Can I use STOMP in nodejs without message broker?

I'm working on creating mock sever for my Angular application. On frontend I have library for STOMP. And regularly my frontend communicates with Api written in Java.
But additionally I start mock nodejs api which returns hard coded Json files when remote server is down.
Now I'm trying to write mock nodejs websockets server which will community with Angular client when remote server is down. But I would like to keep it simple
I found StompJs library but seems like it needs STOMP message broker (like Rabbit?). It's seems to me a bit complicated for mock server. Is there any option to skip this broker step and keep it as simple as possible?

What is the best Socket.io alternative in AWS serverless

I'm building a custom serverless chat on AWS.
I want to use WebSockets for updating the messages.
I found that Socket.io is amazing for what I need and it also supports heartbeat as fallback if WebSockets does not work.
My problem with Socket.io is that is does not have server for AWS ApiGateway.
Is there any library that will replace Socket.io for me on serverless?

Trying to access Redis via React: Can't resolve 'hiredis'

I've created a simple react app via create-react-app and I'm trying to access my Redis DB using the node redis client.
When I start up my app, I receive the following error:
Module not found: Can't resolve 'hiredis' in
'/Users/Joseph/workspace/chatbots/diagnosis-bot/symptom-search/node_modules/redis/node_modules/redis-parser/lib'
I have a feeling it is because redis is actually made for node and not react, but still want to know whether there is any workaround this without having to make a separate back-end node app just to access Redis.
I do not know of any way you could connect to Redis without an intermediary using React.
There are security issues with trying to connect directly to Redis from a front-end application: you would have to expose users to your connection details.

Socket io private messages using expressjs nodejs mongoose

I'm struggling with socket.io to make a chat app with the users that are logged in in my app. I followed the beginner course and I could make a private chat app, but the users aren't the ones that are in my database or they have to create a username to connect to the chat app.
In my search I found this one -
Realtime app with Vue, Laravel, Socket.io and Redis (He's making a similar app using Laravel)
I want the exact same app but using nodejs mongoose express.
Can you help me with some references or tutorials?
Here are some resources that might -
Make A Real-Time Chat Room using Node Webkit, Socket.io, and MEAN
Simple Chat Application using NodeJS and Socket.IO
Please start with any of these and be more specific with what extra feature you're trying to implement. (code would be very helpful)
Couldn't understand what do you mean by the users not in database bit.

Node.JS as a REST service and Angular.JS with socket.io

I have a node.js server which only acts as a RESTful service. I have an angular js frontend which consumes the JSONs sent by Node server. I want to integrate socket.io into this application.
I tried https://github.com/btford/angular-socket-io but get weird errors like io is not defined and Unknown provider: $animateProvider. Are there any good examples with the exact scenario?

Resources