Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

branch: websocket #130

Open
jessegreenberg opened this issue Jan 17, 2019 · 1 comment
Open

branch: websocket #130

jessegreenberg opened this issue Jan 17, 2019 · 1 comment

Comments

@jessegreenberg
Copy link
Contributor

Like #117. But instead of using nexus we are using a basic websocket. Once a server is set up, the WebSocket can be used to control the position of the wrench by the orientation of a phone or mobile device.

@jessegreenberg
Copy link
Contributor Author

This was pretty simple to set up, changes to sim code were almost identical to changes for nexus in #117 (which also is driven by WebSocket). The tricky part was setting up the server. This documentation is in the branch in WOASModel.

    // hacks for websocket!!
    // NOTE: You will have to change this IP to the devices adress, and the devices MUST be on the same network
    // Take a look at this example on how to set up a websocket with npm:
    // https://www.sitepoint.com/real-time-apps-websockets-server-sent-events/
    // 
    // Then in the client webpage, add a listener to the page that monitors device orientation like
    // var handleOrientation = function( event ) {
    //   var absolute = event.absolute;
    //   var alpha    = event.alpha;
    //   var beta     = event.beta;
    //   var gamma    = event.gamma;
    //   
    //   var json = JSON.stringify( {
    //     message: 'orientation event',
    //     beta: beta,
    //     absolute: event.absolute,
    //     alpha: event.alpha,
    //     gamma: event.gamma
    //   } );
    //   socket.send(json);
    // }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant