I want to create an app for some simple multiplayer game but I don't know how to create websocket server in Flutter. Any ideas?
You could use the SocketServer class (TCP). I have used this for a similar problem.
For a more complete answer, take a look at:
Using Flutter App to run SocketServer and communicate with other phone via Socket
flutter has got it covered in a very decent manner in its documentation check out
here
Related
Im find https://github.com/cloudwebrtc/flutter-webrtc for use webrtc in flutter. But in repository, the sample is only peer to peer with 2 devices. I have build app for my customer for video call with many people. It's possible use this package for build video conference (2+) in flutter?
Yes, you should be able to establish a video call with many people using WebRTC and this package.
One approach would be to create a new RTCPeerConnection for every new peer in your room.
Check out this example, it does exactly that.
However, since WebRTC is intended for peer-to-peer, this solution is not scalable at all, because you are going to be creating new peer connections exponentially.
With ~6 people, the quality of your call will already be terrible.
If your intention is to have a conference room, you should really look into using a Selective Forwarding Unit (SFU), if you plan to be scalable at all.
Checkout Janus VideoRoom plugin for an open-source SFU implementation, just be aware that it's a bit cumbersome to set it up.
For room video call, or live stream... you have to use a Media server to make it, webrtc just allow 2 peer, need a Media server to be an intermediaries
unfortunately, you cannot use it for 2+ communication, because the main idea of webRTC is connect two sides through P2P.
I want to send an email. But if there is no internet connection I want to listen if the connection is resumed, and try to send the email again. Even when the app has been closed.
Is there an equivalent for BroadcastReceiver and Service in Flutter?
It should work on Android and iOS.
Currently, there are new versions of plugins mentioned in the comment by Günter Zöchbauer.
connectivity_plus
android_alarm_manager_plus
And for the alternative of android_alarm_manager_plus for iOS, this blog post featured workmanager plugin. Which uses the newer WorkManager API
The fluttercommunity as mentioned here, is currently working on this feature that will closely match the existing Android workmanager implementation.
See also "Checking Network Connectivity In Flutter" for some good sample of implementing connectivity plugin.
I am looking for a way to have one iPhone app send a message to another app on a different phone (sort of like a Sender-Receiver set up). I am looking for the best possible way to do this. Does anyone have any ideas and/or tutorials?
Thanks for the help.
You should use GameKit. It is super easy to send messages between two iOS devices using it. Here's a great tutorial: Game Kit. You can also get more information about it here from the docs: About Game Kit.
You communicate by creating an ad-hoc bluetooth or local wireless network.
lmirak provided insightful info about device communication(especially about GameKit). I would like to add one more solution. You can use WiFi network to do your device communication.
See the link or download the sample application from developer.apple
The sample application named as WiTap. It demonstrates how to achieve network communication between applications. Using Bonjour, the application both advertises itself on the local network and displays a list of other instances of this application on the network.
If your app is only going to run on iOS, then you should use the fantastic MultipeerConnectivity library. https://developer.apple.com/documentation/multipeerconnectivity
If you need a solution that will work cross-platform, then one way to accomplish this is using sockets and connecting over a local network. On iOS you can use CocoaAsyncPods for sockets and NetService for discovery.
Here is a basic example app that does this: https://github.com/brendaninnis/LocalNetworkingApp
, which I explain in great detail here: http://brendaninnis.ca/connect-nearby-devices-part-1.html
I'd like to play with the idea of creating a server program that communicates with an iPhone app over socket connections. I've found several guides within Apple's documentation for client side programming (with CFNetwork, NSStream, etc) but I don't know where to begin on programming the server application, or even what language to use, or for that matter, how to deploy and run a server application on my current web hosting package through Go Daddy. A simple instant messenger style application example should get me started, but any advice is appreciated.
if you want to create socket connection is better to use CFNetwork , it has more flexibility for you I already used NSURLConnection but CFNetwork has better performance. this is my steps and how I developed my app :
configuration of server
selection C++ for my server side (service)
start to develop a client-side app for iphone to connect to server using NS classes
but I had some problems in sending and receiving message to and form server . so I changed it to CF classes it works better and faster now.
The easiest way to handle server-to-device communications is to use APNS (Apple Push Notification Services).
Communication in the other direction (device-to-server) can be handled simply with NSUrlConnection.
If you want to write your own socket code for this, well - good luck with that.
Do you want your client application to be able to run on more than one OS? If so, you might want to stay clear of anything Apple specific. Although, if you strictly want to run on iOS, using MusiGenesis' suggestion could save you a ton of time.
I have found that Python and Perl are both pretty great for socket programming. I know that Python has several libraries built in for handling HTTP requests etc. If you want to run your server as a daemon, I found this code very helpful:
http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
Here is a general python sockets guide:
http://docs.python.org/howto/sockets.html
Good luck.
I have one application in which all available clients are displayed.Now i want
to implement chatting between them.can it be done with help of bonjour service without
having any other server in between them?any tutorial or sample code for that?
These links might be useful.
http://mobileorchard.com/tutorial-networking-and-bonjour-on-iphone/
you can find source code on https://bitbucket.org/snej/chatty/src
thanks
Game Kit provides a high-level peer-to-peer connectivity API, which you can use for chat.