<commit_before>
Hub and Client Configurables
----------------------------


Creating a Notifier
-------------------

### The Client

```coffee

notice = require 'notice'
TelevisionRemote = notice.client

    capsules: 

        channel: {}
        volume:  {}
        pause:   {}
        play:    {}
        ffwd:    {}

```
The `TelevisionRemote` definition can now be used to create a notifier instance.

```coffee
{TelevisionRemote} = require './the/previous/block'

TelevisionRemote.create 'Family Room',

    context: 
        supremeAuthority: 'Mother' unless Grandfather? || Saturday?

    connect: 
        address:           'localhost'
        transport:         'https'
        port:               10101
        secret:             process.env.SECRET
        errorWait:          1000
        rejectUnauthorized: false # tolerate self sighned cert on serverside

    (err, remote) -> 

        #
        # callback receives the connected remote or error
        #

```

#### The Title

* Should be unique. 
* The hub will not allow a second instance of the 'Family Room' television remote to connect.

#### The Context

* The client sends the context object to the hub during the connection handshake.
* This becomes available in the `context.origin` object as passed along all hubside middleware traversals that contain a capsule originating from this client.

#### The Connect

* The connection specification sets paramaters used for connecting to the hub. 
* Both https and http are using socket.io to facilitate the transport. 


### The Hub

```coffee

notice = require 'notice'
Television = notice.hub

        #
        # requires the same capsule definitions as the client
        #

Television.create

    listen:  
        # server:  existingHttpServer
        # address: '0.0.0.0'
        port:    10101
        secret:  'right'
        cert:    __dirname + '/../../cert/develop-cert.pem'
        key:     __dirname + '/../../cert/develop-key.pem'

    (error, hub) ->

        #
        # callback receives listening hub or error
        # 


```


Emitting Capsules
-----------------

### Node style


### With promise




Using the middleware pipeline
-----------------------------

### Registering middleware


### The middleware function

```coffee

(next, capsule, context) -> <commit_msg>The Listen Spec<commit_after>
Hub and Client Configurables
----------------------------


Creating a Notifier
-------------------

### The Client

```coffee

notice = require 'notice'
TelevisionRemote = notice.client

    capsules: 

        channel: {}
        volume:  {}
        pause:   {}
        play:    {}
        ffwd:    {}

```
The `TelevisionRemote` definition can now be used to create a notifier instance.

```coffee
{TelevisionRemote} = require './the/previous/block'

TelevisionRemote.create 'Family Room',

    context: 
        supremeAuthority: 'Mother' unless Grandfather? || Saturday?

    connect: 
        address:           'localhost'
        transport:         'https'
        port:               10101
        secret:             process.env.SECRET
        errorWait:          1000
        rejectUnauthorized: false # tolerate self sighned cert on serverside

    (err, remote) -> 

        #
        # callback receives the connected remote or error
        #

```

#### The Title

* Should be unique. 
* The hub will not allow a second instance of the 'Family Room' television remote to connect.

#### The Context

* The client sends the context object to the hub during the connection handshake.
* This becomes available in the `context.origin` object as passed along all hubside middleware traversals that contain a capsule originating from this client.

#### The Connect Spec

* The connection specification sets paramaters used for connecting to the hub. 
* Both https and http are using socket.io to facilitate the transport. 


### The Hub

```coffee

notice = require 'notice'
Television = notice.hub()
Television.create

    listen:  
        # server:  existingHttpServer
        # address: '0.0.0.0'
        port:    10101
        secret:  'right'
        cert:    __dirname + '/../../cert/develop-cert.pem'
        key:     __dirname + '/../../cert/develop-key.pem'

    (error, hub) ->

        #
        # callback receives listening hub or error
        # 


```

#### The Listen Spec

* Hub configuration should define a listen specification.
* It starts a socket.io server.
* An existing `httpServer` object (eg express) can be assigned.
* Otherwise a new http or https server will be created.
* If specified and present, cert and key lead to the creation of an https server.


Emitting Capsules
-----------------

### Node style


### With promise




Using the middleware pipeline
-----------------------------

### Registering middleware


### The middleware function

```coffee

(next, capsule, context) -> 
{'fraction_non_alphanumeric': 0.12582101806239737, 'fraction_numerical': 0.007389162561576354, 'mean_word_length': 2.08808618504436, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1511157', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1227, 'n_words': 476}