Comments (6)
Hi @viniciuscb
I think it make sense to add stopReceivingMessage
and stopReceivingFile
🙂 Would you mind to contribute and add these methods? 👀
Sometimes the connection is closed
Would be good to understand the reason behind it, i. e. why the connection was closed. Is it a bug in a library or it depends on external factors, such "user closed app"/"distance to receiver side became too big and because of that the signal was lost"?
Also maybe would be good to send an event "CONNECTION_CLOSED" or something like that, if we actuall can derive this event.
from react-native-wifi-p2p.
Got it @viniciuscb 👍
Then I think we'll need to have stopReceivingMessage
/stopReceivingFile
methods and it would be very helpful to know, when "CONNECTION_CLOSED" event occured (to actually call stopReceivingMessage
/stopReceivingFile
methods). Agree?
P. S. I'm going to create 3.4.0
release, but I'll be glad to release 3.5.0
with new API methods if you submit PR 😊
from react-native-wifi-p2p.
@viniciuscb I think if you rewrite and migrate away from AsynTask, then you may not worry about backward compatibility :)
In my opinion it's useful to know sender address - of course it will be breaking change, but it will be easy to migrate.
Moreover I already have some deprecated methods in API and I would like to remove them and publish new 4.0.0 version :)
from react-native-wifi-p2p.
Hi Kirill. The problem with sendMessage is happening due to external factors. For instance, when the app crashes/is closed in one device, and I didn't receive yet (in the other device) the information that the connection changed in react native level (through listeners/subscribe methods).
from react-native-wifi-p2p.
I see now that the AsyncTask class became deprecated in API 30. So the receiveMessage will need to have a refactoring anyway.
From: https://developer.android.com/reference/android/os/AsyncTask
AsyncTask was intended to enable proper and easy use of the UI thread. However, the most common use case was for integrating into UI, and that would cause Context leaks, missed callbacks, or crashes on configuration changes. It also has inconsistent behavior on different versions of the platform, swallows exceptions from doInBackground, and does not provide much utility over using Executors directly.
Besides that, @kirillzyusko and @seba9999 , maybe we can pass an optional parameter to receiveMessage to receive also the metadata (currently only the origin IP address). This way we can maintain backward compatibility.
from react-native-wifi-p2p.
I've proposed a PR ( #80 ) that does not break backward compatibility.
from react-native-wifi-p2p.
Related Issues (20)
- DeviceEventEmitter.removeListener is deprecated HOT 1
- transmit an image from a camera HOT 1
- Set Group Owner operating frequency band HOT 1
- Is there a way to get device Address with ipv4 format ? HOT 2
- Example code is not working HOT 15
- unsubscribeFromPeersUpdates : EventEmitter.removeListener() : Method has been deprecated HOT 5
- Adding something like broadcastTo(message, addresses, promise) HOT 14
- Urgent: Sending File from Server to Client HOT 5
- Could not resolve all files for configuration ':react-native-wifi-p2p:classpath' HOT 7
- Android 13 rejects startDiscoveringPeers() with code 0 HOT 7
- Receive messages when the device is a mobile hotspot HOT 1
- connectionInfo is not updated when connection closes HOT 5
- SendMessageTo - can't use MAC address and we don't have ip addresses HOT 7
- sendFile and receiveFile refactoring HOT 6
- I want to make a real-time-streaming (Two Android devices connected 1:1) HOT 2
- Get Available devices not working HOT 4
- getAvailablePeers() always return empty array HOT 3
- method getAvailablePeers() always return empty device array HOT 1
- TypeError: null is not an object (evaluating 'WiFiP2PManager.init') HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-wifi-p2p.