Skip to content

Send and receive phone device events (acceleration, orientation, etc) with web sockets in Angular

Notifications You must be signed in to change notification settings

mandarini/AngularSockets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Angular Sockets

This project was generated with Angular CLI version 1.6.6

Based on

This brilliant websocket socket.io setup tutorial by elliotforbes

Description

We are creating a server and a client that listens for incoming messages.

The server can run on a mobile device and thus emit messages to the client.

The messages are information about the device status.

The result is to maniputale graphics on the screen with our mobile device.

How to

Run the server

First we need to get the server running:

cd browserServer/
node app.js

This will run your express server.

Then, in the same directory (browserServer), in a new terminal, run:

ng serve --host 0.0.0.0

That way, we will be able to access our local address from a mobile device connected to the same network.

Now, navigate from your mobile device or from your browser to:

<your local IP address>:4200

where the application is running.

You can find your local IP address running

ifconfig

That would be one of your inet addresses.

Run the client

cd browserClient/
ng serve --port 4000

You need to specify another port than the default 4200, because the server is already running on 4200.

Finally, send a message!

Now, either click the send message button or move your phone around, and see the result in your browser!

Making use of experimental technology!

Such as Detecting device orientation

and DeviceMotionEvent

and using them to manipulate a cube on our canvas!

About

Send and receive phone device events (acceleration, orientation, etc) with web sockets in Angular

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published