How can i setup a Socket.io client on flutter? - node.js

I have a flutter app and i am trying to connect it to a node.js localhost server. it works with react js but I haven't done it in flutter before. can I get help on sending a simple connection to my server socket io?

It's pretty easy. You'll basically have to use this package to connect to your backend. The idea is pretty similar to JavaScript applications.
In case you need it, I already implemented a simple application using it on Flutter. It's pretty straightforward and you only have to focus on mobile/lib/config/socket.dart which is my socket client.
It contains three simple methods used to emit events and subscribe/unsubscribe to events. Any doubts just ask it.
EDIT:
In case you have any problem connecting to your backend add this line to your Android Manifest. I remember I had some problem because of the android version which had cleartext disabled by default.

Related

Electron like node integration in nodejs web server

I'm new to web servers in nodejs and i'd like to know if there is possible to have an electron like node integration in a web server (to be able to use nodejs in index.js script file linked to index.html)
Thx for all :)
It's not possible. Browsers control the way that client side JavaScript is executed, so it's just technically impossible to connect both runtimes in any way that works on client machine, you'd need a customized browser, which is what Electron basically is. And neither should you want to - if the runtimes were connected in that way, any user could execute arbitrary commands on your server.

Connect to remote Realm with nodeJS for server side and Angular for client side, good practice?

I'm currently trying to figure out which technologies to use in order to maintain "realm features" in a web browser application. I've put together a rudimentary Swift app on iOS which allows for real-time updates coming from realm cloud.
I've spent the last 3-4 hours reading about Nginx, nodeJS, Angular, Express (angular framework) and other technologies.
As far as I've been able to understand, Realm can work with GraphQL which in turn lists nodeJS as a dependency (https://docs.realm.io/sync/getting-started-1/web-based-graphql).
So far I have a Debian 10 server running nginx. I have also installed nodeJS and NPM.
Assuming that I'm on the right path, where do I go from here?
It's proving to be a pretty tough challenge for me but, any help is greatly appreciated!
Thank you for your time.
Regards,
Renato

Can Node.JS integrate inside Flutter mobile application?

I created a mobile application with flutter in front end and back end with node.js but I want it to use node js in offline mode in another meaning I want host this node inside the mobile. can I?
No.
First, you'd need NodeJS itself built for you mobile platform. Only then can you even consider running the node application you've written.
Flutter is Dart and NodeJS is well, JS. You can't put them together. But if you are building a node app that builds into a static js and html, may be you can put it in a webview, which does not seem to be the case here.
You are asking to run server side code on the client itself and offline too. If the application can really be offline, I think you're better off without a backend and store everything static within the flutter app itself.

how can i track my mobile app user when the app is killed

i want to implement tracking in my app but i am confused on how to get the location from the app if the app is not opened and send it to the server i tried socket , GPS-tracking but it did not work.
can any one guide me to how this is implemented and any resources or libraries to use ?
For Android projects React Native includes headless JS that does just what you are asking.
iOS is more complicated but the best solution I've found is a package called React Native Background Geolocation
Unfortunately this is not possible in a PWA without a plugin due to W3C's and Jake Archibald's refusal to implement the TravelManager detailed here
If the TravelManager were to be implemented a ServiceWorker intance would be automatically spun up on change of location in order to foreground your Web App or instantiate a new instance.

Unity3D websocket client with Node.js server?

I have a game server made in Node.js, and am building a Unity3D client for it. I have already built a pure Javascript web client for the same server as well, which works great.
I was able to build the client for Unity3D using the websocket-sharp, but it is kind of slow, and was wondering if there are any better libraries to use such as UNET that would for for this.

Resources