I'm currently creating whatsapp clone using Mern and get to know word Pusher but I want to know why pusher is basically used? is there is any alternative in Mongodb
Related
I'm currently using a RealTime database to implement a chat for my react native application. In prepping it for production, I'm trying to secure the connection. I know that is it best to have all connections in the backend so it's not available on client-side. However, to use the onValue function from Firebase, it needs the ref details. I tried to make the backend return the ref, but it only returns the URL to the table. Is there a way to have the frontend auto update the chat with onValue calls in the backend? I'm using NodeJS as my backend. Thank you!
I've tried passing the db/ref. I know socket is a possible implementation, but that would require a larger rewrite. Trying to avoid that if possible.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have been trying to connect my flutter app with a node.js backend to send images and I don't know how to begin to code this. I have a vague idea about writing apis using node.js. My flutter app should take an image using the camera and send it to the backend
Starting from Flutter frontend, your can use a package like image_picker to pick an image file from your camera or gallery.
On backend side if your are using nodejs(using express will be a good option for API) and mongodb(a no-sql dbms), you can create a collection for storing all your images as documents.
Helper link for express routing : https://expressjs.com/en/starter/basic-routing.html
mongoose is a good library for nodejs that will make your work a lot easier.
Once that's done you can create you own apis which will be inititally hosted on your own computer(localhost) using functions like app.post() etc. provided by express. Here you can create a POST request which will take the image file from frontend as form-data. Extract the image from the body and store it in your database.
Then you will also need to make a GET request to take that image file from your database and pass it to your frontend.
Then using the flutter's inbuilt http functions or using http package, you can extract the images from your database using the API's you made.
Unfortunately I can't explain thing in details in just one answer, so you will have to do a lot of research yourself. Below are some links that will help you if you choose node(express) as backend framework and mongodb as database.
Best example of storing and retrieving images using express and mongo db : https://gist.github.com/aheckmann/2408370
Follows the same technique as above but explains what he's doing : https://medium.com/#alvenw/how-to-store-images-to-mongodb-with-node-js-fb3905c37e6d
There is a few ways to do it, I will probably do like this.
On the nodejs part, create a simple express server and combine with the package call multer to handling all the incoming file.
And on the flutter part, handle the image using a package call image_picker and sent it in a form data through http
I am trying to implement a messaging feature for users on my website. So that they can send messages to each other. My website is based on NODEJS, EXPRESS, MongoDB. Any hint or reference will be a great help in this direction.
basically I am trying to figure out a way to make a connection between my Discord Bot and my Website, I have some ideas in mind in using GET and POST methods but IDK how to use them in NodeJs nor in the website as I am still new to it, so what I want is to send a packet of data from the website after a submit button and the bot which is hosted locally with the website will receive this data and work with it.
Express is a commonly used web framework for Node that takes care of routing fairly easily. You can see their documentation here.
I want to implement the telegram-mtproto using nodejs and create a client nodejs telegram app but I don't know how to do this. the api and protocol part in telegram website make me confused and I didn't understand anything from them.
my starting question is how to create a keppalive connection with telegram server?
Take a look at How to implement authorization using a Telegram API? it's the most exhaustive answer that exists on the subject. None of the code is in Node but with some effort you'll be able to translate things.