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?
Related
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?
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.
How to develop/refactor a node.js project that uses socket.io and send JSON data from a client to another in a room?
I've developed a project with node js and socket.io that there is a board game in a part of it, the user1 select a place and its information send to the user2 in JSON format and this part developed with socket.io.
now I want to deploy the project to AWS Lambda but I realize that socket.io can't run because of serverless nature, so my question is how can I develop this board game with AWS Lambda and what technology/library can I use?
You cannot do socket.io like bi-directional communication only using AWS Lambda since it is stateless and asynchronous. You can use AWS IOT Web Sockets for this(Optionally with Lambda).
I'm using node js with aws lambda functions for my web application. I want to use web socket in my web app. And socket.io is a very famous library for node.js.
But I'm not sure how can I use it in aws lambda. can anyone let me know how to do it, is it possible using lambda functions?
Can't use socket.io with lambdas. Lambdas have a limit on time it can be executed, so holding open connection with a client is impossible.
What you can do though is use SNS. Lambdas can publish messages to SNS topics and lambdas can be invoked with SNS.
Workaround exists for this - it's the WebSockets over MQTT in AWS IoT. This way you can execute your Lambda functions from open socket connections.
Currently, AWS API Gateway supports WebSockets.
Unfortunately, I didn't manage to connect via socket.io since it generates a custom URL with additional params: /?EIO=3&transport=polling&sid=< id>
But I've found tiny WebSocket wrapper sockette (used this tutorial), and it works fine!
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?