Neanderthals Paint Mammals
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    voxel-clientpublic

    voxel-client

    Enable an app based on voxel-engine to be a client for voxel-server

    Using as a module

    // establish a transport stream with the server 
    var duplexStream = SomeTransportSteam()
     
    var client = new Client({
      serverStream: duplexStream,
      container: document.body,
    })
     
    // use the client.connection [DuplexEmitter](https://github.com/pgte/duplex-emitter) to react to remote events 
    client.connection.on('join', function(user) {
      console.log(user,'joined.')
    })
     
    // or emit your own events back to the server! 
    // Note: to have the server forward the event to all players, 
    // add the event name to `server.forwardEvents` 
    client.connection.emit('attack', attackDetails)

    transport streams

    websockets: websocket-stream

    webRTC: rtc-data-stream

    further reading:

    license

    BSD LICENSE

    Keywords

    none

    install

    npm i voxel-client

    Downloadslast 7 days

    0

    version

    2.1.0

    license

    none

    last publish

    collaborators

    • avatar