Skip to content
Permalink
Browse files

added experimental fromIP server side

  • Loading branch information
ramagottfried committed Nov 6, 2019
1 parent f183fcf commit df67e3a3bdf0135a1b50afc14228e355daa3fa10
Showing with 141 additions and 39 deletions.
  1. +31 −2 README.md
  2. +14 −3 code/node/drawsocket-server.js
  3. +96 −34 dev/tween-powered-clock.maxpat
@@ -408,8 +408,37 @@ Additionaly, HTML layers may be created with a new `div` tag, just as discussed
* `vars`: an object containing the variables to animate, and their destination values, and any other TweenMax special properties (see the [TweenMax vars documentation](https://greensock.com/docs/TweenMax/vars) for more information).
* `cmd`: same as the `tween` commands, but applied to the timeline.

One special `var` parameter has been added to handle the `onUpdate` callback.
* `var`:`onUpdate` : an inline string function to be called when a new frame is processed by the `tween`.
A special `function` keyword has been added to handle the `tween` `var` callbacks. For example:
```
/* : {
/key : "tween",
/val : {
/id : "clock-tween",
/target : "#clock",
/dur : 3600,
/vars : {
/x : "+=0",
/ease : "linear",
/paused : "true",
/onUpdate : {
/function : "
let text = document.getElementById('clock');
let seconds = this.time() % 60;
if( seconds < 10 ) seconds = '0'+seconds;
let minutes = Math.floor( this.time() / 60);
if( minutes < 10 ) minutes = '0'+minutes;
text.innerHTML = minutes+':'+seconds;
"
}
}
}
}
```
See the [TweenMax vars documentation](https://greensock.com/docs/TweenMax/vars), for more information about callbacks.


## __pdf__
PDF files may be imported into `drawsocket` by reference, the settable attributes are as follows:
@@ -179,7 +179,7 @@ if (cluster.isMaster)

let disconnectionMsg = {};
disconnectionMsg.event = {
url: "/foo",
url: "/tmp",
key: 'status',
val: {
connected: 0
@@ -191,7 +191,7 @@ if (cluster.isMaster)
wss.on("connection", function (socket, req) {

let uniqueid = req.headers['sec-websocket-key'];

// Max.post("A Web Socket connection has been established! " + req.url + " (" + uniqueid + ") " + req.connection.remoteAddress);

// setup relay back to Max
@@ -249,7 +249,14 @@ if (cluster.isMaster)

}
else
{
// note a client could potentially have more than one tab open,
// so maybe we should also use the uniqueid here...

obj.fromIP = req.connection.remoteAddress;
Max.outlet(obj);
}


} catch (e) {

@@ -264,7 +271,8 @@ if (cluster.isMaster)
socket.terminate();

disconnectionMsg.event.url = req.url;

disconnectionMsg.fromIP = req.connection.remoteAddress;

Max.outlet(disconnectionMsg);

// Max.post("closed socket : " + uniqueid + " @ " + req.url);
@@ -274,6 +282,9 @@ if (cluster.isMaster)
socket.on("error", function (event) {
clients.removeClient(req.url, uniqueid);

disconnectionMsg.event.url = req.url;
Max.outlet(disconnectionMsg);

Max.post("error on socket : " + uniqueid + " @ " + req.url);
Max.post(event);
});

0 comments on commit df67e3a

Please sign in to comment.
You can’t perform that action at this time.