Multiple Peer Clients

Options
Hi,

it seems that you cannot (or better should not) create multiple peer clients. According to the implementation the peer client stores certain properties in the its prototype (refer to lines 1551ff in PhotonPeer.Lite.debug.js).

To give you a working example please have a look at the following code snippet:
        var peer1 = new PhotonPeer.Lite();
        var peer2 = new PhotonPeer.Lite();

        peer1.addEventListener( 'connect', function() {
            console.log( "Peer1 connected." );
        });

        peer2.addEventListener( 'connect', function() {
            console.log( "Peer2 connected." );
        });

        peer1.connect( 'localhost', { port: 9090, isDebugging: true } );
        // peer2 does not call the connect

Is this intended to work that way ?

Best,
benny!

Comments

  • [Deleted User]
    Options
    While not intended to be like that that is the current behavior, yes.

    We might update the library at some time, currently this is not being planned for any soon.

    fyi