// CLIENT

Object._ = function(){} 

var shoe = require('shoe')
, MuxDemux = require('mux-demux')
, bricoleur = require('./_brico')
, tmp_id = null
, id = null

var brico = new bricoleur({scope:'client'})

var bus = shoe('/bus')

bus.on('connect', function () {
  tmp_id = new Date().getTime() 
  bus.write(JSON.stringify({tmp_id:tmp_id, host:document.URL}))
})

bus.on('data', function (json) {
  var data = JSON.parse(json)

  if (typeof data === 'object') console.dir(data)
 
  if (data[tmp_id]) {
    console.dir(data[tmp_id])
    id = data[tmp_id]
  }

  if (data.id === id) { // handle data -- pass to brico
  }
})

setTimeout(function () {
  console.log('sending to ... '+id)
  bus.write(JSON.stringify({id:id, params:['test',2,'r']}))
}, 900)

@@ -125,16 +125,68 @@
 brico')%0A
+, host = docuement.URL.split('//')%5B1%5D.split('/')%5B0%5D%0A
 , tmp_id
@@ -337,18 +337,16 @@
 getTime(
-) 
 %0A  bus.w
@@ -390,23 +390,15 @@
 ost:
-document.URL%7D))
+host%7D)%0A
 %0A%7D)%0A

format host nicely in clnt