multipeer | Pythonista class for iOS multipeer connectivity

 by   mikaelho Python Version: Current License: Unlicense

kandi X-RAY | multipeer Summary

kandi X-RAY | multipeer Summary

multipeer is a Python library. multipeer has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. However multipeer build file is not available. You can install using 'pip install multipeer' or download it from GitHub, PyPI.

Peer IDs passed around by the wrapper have a display_name member that gives you the display name of that peer. There is no guarantee that these names are unique between peers. The IDs act also as identifier objects for specific peers, and can be used to send messages to individual peers. You cannot create peer IDs for remote peers manually.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              multipeer has a low active ecosystem.
              It has 14 star(s) with 6 fork(s). There are 2 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 4 have been closed. On average issues are closed in 12 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of multipeer is current.

            kandi-Quality Quality

              multipeer has no bugs reported.

            kandi-Security Security

              multipeer has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              multipeer is licensed under the Unlicense License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              multipeer releases are not available. You will need to build from source code and install.
              Deployable package is available in PyPI.
              multipeer has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed multipeer and discovered the below as its top functions. This is intended to give you an instant insight into multipeer implemented functionality, and help decide if they suit your requirements.
            • Select the player s color
            • Start a random robot
            • Move the cursor forward
            • Calls the given function with the given arguments
            • Invoked when a Peer is received
            • Check if the current track is open
            • Collect stats for a peer
            • Sets up an output stream
            • Send message to peer
            • Get list of connected peers
            • Called when all players have completed
            • Send message to peers
            • Called when a session received data from a peer
            • Called when a player is committed
            • Add a turn
            • Update the player track
            • Handle incoming message
            • Called when the player is committed
            • Called when a stream is received from a peer
            • Gets the next turn
            • Called when the peer has changed
            • Called when a player is found
            • Called when a browser is found
            • Receive incoming data from peer
            • Context manager that creates a menu
            • Return the next turn in the track
            • Context manager for all players
            Get all kandi verified functions for this library.

            multipeer Key Features

            No Key Features are available at this moment for multipeer.

            multipeer Examples and Code Snippets

            Multipeer,Usage
            Pythondot img1Lines of Code : 13dot img1License : Permissive (Unlicense)
            copy iconCopy
            import multipeer
            
            my_name = input('Name: ')
            
            mc = multipeer.MultipeerConnectivity(display_name=my_name,
              service_type='chat')
            
            try:
              while True:
                chat_message = input('Message: ')
                mc.send(chat_message)
            finally:
              mc.end_all()
              
            API,Class: MultipeerConnectivity
            Pythondot img2Lines of Code : 1dot img2License : Permissive (Unlicense)
            copy iconCopy
            mc = MultipeerConnectivity(display_name='Peer', service_type='dev-srv')
              
            Multipeer,Installation
            Pythondot img3Lines of Code : 1dot img3License : Permissive (Unlicense)
            copy iconCopy
            pip install pythonista-multipeer
              

            Community Discussions

            QUESTION

            NSNetServiceBrowser did not search with error -72008 on iOS 14
            Asked 2020-Dec-14 at 12:41

            The same error is also triggered setting up Multipeer Connectivity (which uses Bonjour). The code I was using for initiating Bonjour browsing and Multipeer Connectivity was modified from the Apple sample code and worked fine under iOS 13.

            ...

            ANSWER

            Answered 2020-Dec-07 at 21:59

            You need to add the following keys to the Info.plist: NSLocalNetworkUsageDescription and NSBonjourServices. E.g.

            Source https://stackoverflow.com/questions/65190065

            QUESTION

            WebRTC switch camera
            Asked 2020-Jul-30 at 11:41

            I am currently working for WebRTC multipeer connection. I want to implement feature to switch camera from front to back while on call. This is the code I am using to switch cameras

            ...

            ANSWER

            Answered 2020-Jul-28 at 12:56

            You are probably being unable to cause a renegotiaton so change to the facingMode of your camera cannot affect the other peers, but you do not use this explicitely as I see but replaceTracks. But still you may not being able to trigger a renegotiation. Checkout things that cause renegotiation: https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/replaceTrack#Usage_notes

            Changing facingMode setting by applying constraints with applyConstraints may be a solution without using replaceTracks.

            A strange idea coming to my mind to dispatch negotiationneeded event yourself, but I would try this after chasing the reason not being able to casue renegotiation itself by replacing track, or changing camera, and everything else.

            About another reason: As for the reasons that casues renegotiation, your back camera resolution is most probably higher than the front camera, so it looks like a reason. If you start from the back camera first and then switch to front it might have been a no reason. I am suspicious about your max constraints of width nad height. They might be very lower for the both camera hence resulting in the same size, resoltion and so a no reason according to the list in the linked page above. I suggest removing them.

            Also the replaceTracks returns a promise but the map function it is called from does not return anything, hence undefined. You are supposed to use the promises inside the array argument to Promise.all. I would suggest return those promises inside the map function.

            Source https://stackoverflow.com/questions/63073829

            QUESTION

            Connect to a peer based on IP address and port
            Asked 2020-Jun-25 at 19:18

            I've got an app that supports Bonjour and manually connecting to an IP (all within the same local network). I'm now looking at whether I can use MPC instead and while it obviously would be able to replace Bonjour, I haven't seen anything that allows me to replace the functionality around manually connecting to the IP. For context, my app runs in networks that have multicast disabled which is when users fall back to manually entering the IP address.

            I could have the receiving app host a webserver and send a request there. Could I create a Peer based on the ip:port combination? That would allow me to make use of MPC for the MCSession aspect.

            Is it possible to set up a Multipeer Connection based on an ip:port rather than having it automatically discovered via multicast?

            ...

            ANSWER

            Answered 2020-Jun-25 at 19:18

            I'll go with a solution based on NWConnection which uses NWEndpoint and can be created with both IP:port and a Bonjour-established service.

            If I would've had access to the full Network.framework then I could've used that for both discovery & communication but due to SDK constraints I'll be using MultipeerConnectivity for the discovery aspect instead. By providing the device its IP & port when broadcasting the Bonjour service, another device can discover it automatically and then use the extra info to create an IP:port-based NWConnection.

            Source https://stackoverflow.com/questions/62541700

            QUESTION

            Issue in starting up Hyperledger Explorer
            Asked 2020-May-25 at 02:10

            I have created a multipeer network. I have created 3 orgs StancOrg , StancOrgA ,StancOrgB.Here's the configtx.yaml file.

            ...

            ANSWER

            Answered 2019-Jan-15 at 20:22

            Paths should be set using the full path /home/user/yourPath instead of the shortcut ~/yourPath.

            Anyway, remember always to check the app logs and not just the console since sometimes they show much more information.

            Source https://stackoverflow.com/questions/54195319

            QUESTION

            Multipeer Connectivity not working after Xcode 11 update
            Asked 2020-Jan-14 at 15:31

            I am trying to build a basic application to send messages between nearby iOS devices with Multipeer Connectivity Framework. I have tried many tutorials but it seems in Xcode 11 browsing nearby devices and accepting requests does not work as it did before.

            Here is my view controller & delegate methods:

            ...

            ANSWER

            Answered 2019-Oct-26 at 21:48

            It seems MCAdvertiserAssistant and MCBrowserViewController are not updated for latest versions of iOS & Swift, hence they're not working properly.

            I solved it by using MCNearbyServiceAdvertiser instead of MCAdvertiserAssistant and MCNearbyServiceBrowser instead of MCBrowserViewController. Note that by using these classes, you'll need to perform basic operations yourself such as listing founded devices, showing and handling invitation alert.. etc.

            You can use these classes as below.

            Definition:

            Source https://stackoverflow.com/questions/58563621

            QUESTION

            SwiftUI ForEach not iterating when array changes. List is empty and ForEach does run
            Asked 2019-Nov-22 at 16:20

            I'm trying to use MultiPeer Connectivity framework with swift ui and am having issues with using ForEach in my view. I have a singleton that I'm using to track connected users in an array:

            ...

            ANSWER

            Answered 2019-Aug-03 at 09:58

            There are a couple issues here as far as I can tell.

            First, I would suggest you try this with your MPCManager:

            Source https://stackoverflow.com/questions/57023712

            QUESTION

            How do I detect the decline of a Multipeer Connectivity invitation?
            Asked 2019-Oct-29 at 22:02

            TLDR:

            When other devices call the invitationHandler after they receive the invitation, I want the device who sent the invitation to know which device(s) accepted the invitation and which device(s) declined it.

            To avoid being an XY problem, here's what I'm doing:

            I am using Multipeer Connectivity for a 2-4 player game.

            The flow of my app is going to be like this:

            • Devices can set their visibility to others by pressing a button
            • One of the 2-4 players of the game, let's call him Player A, will press a button and he/she will see a list of nearby players
            • Player A will choose 1-3 players from the list that he wants to add to the game
            • Other devices use some logic to figure out whether to accept the invitation or decline it.
            • After all the invitations Player A sent has been responded to, a button will be enabled and Player A can press it to start the game.
            • I am doing this since I don't want new players joining after the game starts. If for example, Player A invites Player B and Player B accepts it. Player A then invites Player C but before Player C receives the invitation, Player A starts the game. The game will start but because only 2 players are connected, a 2-player game will be created. After that the invitation reaches Player C and he accepts it and now suddenly there are 3 people in a 2-player game! This is why I need to ensure all invitations are responded before starting the game.

            This is also why I need to know whether a device declined the invitation. I already know how to detect that a device accepted the invitation, just like this:

            ...

            ANSWER

            Answered 2017-Oct-16 at 07:59

            When user declines the invitation the device that initiated the invite will get a delegate state change with state = MCSessionStateNotConnected.

            As far as I know this state will also happen if user fails to connect for some reason, but you could distinguish the two flows since when connection fails you will also get state change first to MCSessionStateConnecting and then to MCSessionStateNotConnected.

            So in short:

            1. State change from MCSessionStateConnecting toMCSessionStateNotConnected means device failed to connect but invite was accepted
            2. State only goes to MCSessionStateConnecting, means user tapped decline

            Given that you need advanced logic when a game can be started you will not be able to rely on the built in MCBrowserViewController since this will have Done button enabled as soon as one of the peers is coonected.

            You would have to use MCNearbyServiceBrowser then you initiate each invite with -invitePeer:toSession:withContext:timeout: and thus you have a way of knowing who was invited, and based on delegate calls who connected, who failed to connect or who declined.

            Hope this helps...

            Source https://stackoverflow.com/questions/46764955

            QUESTION

            Multiple arrays feeding UICollectionView data source
            Asked 2019-Aug-21 at 20:34

            I have an array of a custom class that is used to populate a UICollectionView.

            Additional arrays of the same custom class are created as they are received from other iOS devices (via Multipeer Connectivity). Data objects are contained within the class type, and so are quite large which I do not want to make copies of and my current logic, I was thinking of retaining them in separate arrays.

            With this in mind, how do I manage the UICollectionView delegate methods?

            Item count suggestion. Presuming the 2nd array is empty until MPC sends it's data, its count would be 0 :

            ...

            ANSWER

            Answered 2019-Aug-21 at 20:34

            You can use a helper computed property:

            Source https://stackoverflow.com/questions/57598231

            QUESTION

            How can I invite a peer to a session using a different name from the one that I found the peer with?
            Asked 2019-Aug-21 at 15:39

            I am using the Multipeer Connectivity Framework on macOS, and I am trying to implement the functionality of connecting to other peers. I used a MCNearbyServiceBrowser and displayed the found peers in an NSTableView. I also have a NSTextField for people to enter their display name, which will be the display name of their MCPeerID.

            The workflow is as follows: The user enter a display name, selects a peer from the NSTableView, and press the connect button.

            This means that I don't have an MCPeerID until the connect button is pressed, because before that time the textfield text could still change. However, initialising a MCNearbyServiceBrowser requires an MCPeerID, so I thought I could use a dummy peer ID for the browser, then create the real one when the connect button is pressed, like this:

            ...

            ANSWER

            Answered 2019-Aug-21 at 15:39

            I can think of two solutions: using data contexts or using a second browser

            Using data contexts

            Use your dummy id but don't rely on its displayName property. Instead pass your real display name via the context parameter of invitePeer(_ peerID: MCPeerID, to session: MCSession, withContext context: Data?, timeout: TimeInterval)

            Source https://stackoverflow.com/questions/57160908

            QUESTION

            Multipeer Connectivity: Browsing in Objective-C++ Silently Fails
            Asked 2019-Apr-16 at 05:58

            I'm trying to write the browser/discovery side for a Multipeer Connectivity app in Objective-C++. I think I can advertise, as far as I can tell anyways since I can see it using Discovery (https://itunes.apple.com/us/app/discovery-dns-sd-browser/id1381004916?mt=12). But my browser doesn't see anything. What am I doing wrong?

            ...

            ANSWER

            Answered 2019-Apr-16 at 05:58

            I (finally) figured it out. MultipeerConnectivity needs a run loop. This is not in the documentation.

            I assumed that the MultipeerConnectivity API created the threads and/or loops it needed upon the method call [browser startBrowsingForPeers]. It does not.

            Nowhere in this code is a run loop started. Also, interestingly enough, using a NSThread directly doesn't start a run loop, even though it's implied that it will:

            Your application neither creates or explicitly manages NSRunLoop objects. Each NSThread object—including the application’s main thread—has an NSRunLoop object automatically created for it as needed. If you need to access the current thread’s run loop, you do so with the class method currentRunLoop.

            What will create a run loop (and start it) is CFRunLoopRun():

            The current thread’s run loop runs in the default mode (see Default Run Loop Mode) until the run loop is stopped with CFRunLoopStop or all the sources and timers are removed from the default run loop mode.

            What will stop it, then, is CFRunLoopStop(CFRunLoopRef rl):

            This function forces rl to stop running and return control to the function that called CFRunLoopRun or CFRunLoopRunInMode for the current run loop activation.

            Of course, CFRunLoopStop takes a CFRunLoopRef as an argument. You can get that by using CFRunLoopGetCurrent, just remember it's a reference and may expire at any time. I think you can be pretty sure that the run loop won't die while you're in the callback that's running in the run loop. But I wouldn't count on it sticking around afterwards. In fact, in this case, the whole point is to kill it at this point; so I expect it to go away.

            Source https://stackoverflow.com/questions/55680240

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install multipeer

            Copy the multipeer.py file from Github to your site-packages, or just:.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/mikaelho/multipeer.git

          • CLI

            gh repo clone mikaelho/multipeer

          • sshUrl

            git@github.com:mikaelho/multipeer.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link