These are chat archives for csarven/ldn

17th
Jul 2016
Melvin Carvalho
@melvincarvalho
Jul 17 2016 07:02

Linked Data Notifications

Linked Data notifications is a spec that allows you to send a notification to a user's inbox. In this case we will send a summary of the score you got memorizing a selection of words. The inbox is found using the discovery section in the spec and an HTTP POST of the following type is sent to that inbox for further processing.
Melvin Carvalho
@melvincarvalho
Jul 17 2016 07:09
Pull request sent
Amy Guy
@rhiaro
Jul 17 2016 11:21
Nice one Melvin!
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:21
:)
Amy Guy
@rhiaro
Jul 17 2016 11:24
I can't log in to the app though... error I don't think I've seen before "Could not connect to auth server: HTTP -1"
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:24
oh that's strange
i uses databox
Amy Guy
@rhiaro
Jul 17 2016 11:24
yeah I can see that
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:25
anything in the console?
Amy Guy
@rhiaro
Jul 17 2016 11:25
That was in the console
I can ping databox.me but it won't load in my browser
Maybe the server is having a bad morning
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:25
  // AUTH
  /**
  * TLS Login with WebID
  */
  $scope.TLSlogin = function() {
    var AUTHENDPOINT = "https://databox.me/";
    $scope.loginTLSButtonText = 'Logging in...';
    $http({
      method: 'HEAD',
      url: AUTHENDPOINT,
      withCredentials: true
    }).success(function(data, status, headers) {
      var header = 'User';
      var scheme = 'http';
      var user = headers(header);
      if (user && user.length > 0 && user.slice(0,scheme.length) === scheme) {
        $scope.loginSuccess(user);
      } else {
        $scope.notify('WebID-TLS authentication failed.', 'error');
      }
      $scope.loginTLSButtonText = 'Login';
    }).error(function(data, status, headers) {
      $scope.notify('Could not connect to auth server: HTTP '+status);
      $scope.loginTLSButtonText = 'Login';
    });
  };
I'm just doing a HEAD and looking for the User header
Amy Guy
@rhiaro
Jul 17 2016 11:26
Okay, it's back
I think databox.me just had a moment
What do I have to do to make it send a score?
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:28
once you try a few words you'll get a % running total and number of trails
if you click on the number of of trials it will trigger a send
Amy Guy
@rhiaro
Jul 17 2016 11:28
does it just send it automatically? I'm not seeing any requests going out in the console
oh okay
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:28
yeah sort of undocumented right now :)
Amy Guy
@rhiaro
Jul 17 2016 11:29
hm it didn't look like it did anything
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:29
and you're logged in?
maybe it didnt find your inbox
Amy Guy
@rhiaro
Jul 17 2016 11:29
is it looking for ldp:inbox or solid:inbox?
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:30
Solid terms
which do you use?
var ST = $rdf.Namespace("http://www.w3.org/ns/solid/terms#");
Amy Guy
@rhiaro
Jul 17 2016 11:30
Heh, if you do a HEAD you get ldp if you check the body of my webid you get solid
But actually everything is really slow right now, I think my internet is being dodgy, so that could be affecting things
It was out altogether most of yesterday
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:31
I seem to recall timbl suggested putting the inbox predicate in the turtle
So that's what I look for right now
but I suppose I'd have to write a bit more code to check the HEAD
Amy Guy
@rhiaro
Jul 17 2016 11:32
Sure. As a sender it's up to you what you look for first, although the spec says you should try HEAD if looking in the body fails
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:32
well actually the header should go into the knowledge base of rdflib
Amy Guy
@rhiaro
Jul 17 2016 11:32
But in my case body should succeed
So it shouldn't need to check head
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:32
well I assume GET sends the same headers as HEAD?
Amy Guy
@rhiaro
Jul 17 2016 11:33
yeah sorry I meant headers, not HEAD
Melvin Carvalho
@melvincarvalho
Jul 17 2016 11:33
expect it's a clever 1 liner in rdflib
$scope.inbox = g.any($rdf.sym($scope.user), ST('inbox')) || <something>
Amy Guy
@rhiaro
Jul 17 2016 11:33
oh man, my site seems to be down
Maybe this was the root of all problems
rhiaro @rhiaro goes back to bed
Amy Guy
@rhiaro
Jul 17 2016 11:34
lol see the table on the right: http://www.evohosting-status.com/
Guess which server my site is on.
Sarven Capadisli
@csarven
Jul 17 2016 13:23
@melvincarvalho I'm not having any errors.. I can login with http://csarven.ca/#i and it has a solid-terms:inbox. The app seems to work, but I'm not seeing anything in my inbox.
Melvin Carvalho
@melvincarvalho
Jul 17 2016 13:24
did you click a few words and send an update by clicking the incrementing number?
or does it call this function
  $scope.save = function() {
Sarven Capadisli
@csarven
Jul 17 2016 13:34
the incrementing number sends me to google translate
oh
the number beside that
Melvin Carvalho
@melvincarvalho
Jul 17 2016 13:34
yes
Sarven Capadisli
@csarven
Jul 17 2016 13:38
merged. thanks.
Melvin Carvalho
@melvincarvalho
Jul 17 2016 13:42
great, im writing the bot to process it now
Sarven Capadisli
@csarven
Jul 17 2016 13:42
@melvincarvalho I like the use case a lot. This is a nice addition
Melvin Carvalho
@melvincarvalho
Jul 17 2016 13:42
thanks, did you get a POST in your inbox?
Sarven Capadisli
@csarven
Jul 17 2016 13:42
Might want to expand on why it uses the inbox and sends updates there in your README
Yea
I guess "we will send a summary of the score you got memorizing a selection of words" is sufficient.