Skip to content

Commit

Permalink
work on readm
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Oberstein committed Mar 13, 2014
1 parent b77c0a3 commit 7719471
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
45 changes: 38 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ WAMP provides asynchronous **Remote Procedure Calls** and **Publish & Subscribe*

**Autobahn**|JS is part of the [Autobahn project](http://autobahn.ws/), [MIT licensed](/LICENSE), and the full source code can be found on [GitHub](https://github.com/tavendo/**Autobahn**|JS/).

**Contents**

1. [Getting started](#getting-started)
1. [API Documentation](#api-documentation)
1. [Building](#building)
* [Show me some code!](#show-me-some-code)
* [Getting started](#getting-started)
* [API Documentation](#api-documentation)
* [Building](#building)


# Show me some code!
Expand Down Expand Up @@ -157,13 +156,16 @@ If you are using a module system like [RequireJS](http://requirejs.org/), you ca

1. [Library](#library)
* [Library Version](#library-version)
* [Debug Mode](#debug-mode)
2. [Connections](#connections)
* [Connection Methods](#connection-methods)
* [Connection Callbacks](#connection-callbacks)
* [Connection Options](#connection-options)
* [Connection Properties](#connection-properties)
3. [Sessions](#sessions)
4. [URIs](#uris)
* [Session Properties](#session-properties)
* [Session Logging](#session-logging)
* [URI Shortcuts](#uri-shortcuts)
5. [Subscribe](#subscribe)
* [Active Subscriptions](#active-subscriptions)
* [Unsubscribing](#unsubscribing)
Expand Down Expand Up @@ -420,7 +422,36 @@ A property with the **Deferred factory** in use on this session:
Session.defer


## URIs
### Session Logging

**Autobahn**|JS includes a logging method for convenient logging from sessions.

For example:

```javascript
connection.onopen = function (session) {

session.log("Session open.");

session.call('com.timeservice.now').then(
function (now) {
session.log(now);
}
);
};
```

which will log to the console:

```
WAMP session 2838853860563188 on 'realm1' at 3.902 ms
Session open.
WAMP session 2838853860563188 on 'realm1' at 4.679 ms
2014-03-13T14:09:07Z
```


### URI Shortcuts

Establish an URI prefix to be used as a shortcut:

Expand Down
3 changes: 2 additions & 1 deletion test/timeservice/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ var session1 = null;
connection1.onopen = function (new_session) {

session1 = new_session;
session1.log("Session open.");

session1.call('com.timeservice.now').then(
function (now) {
console.log("S1 Current time:", now);
session1.log(now);
//connection.close();
},
function (error) {
Expand Down

0 comments on commit 7719471

Please sign in to comment.