 ###############################################################################
 
 dom.TAWK = ->
-  space = if @props.space? then @props.space else ''
+  tawk.space = if @props.space? then @props.space else ''
   name = if @props.name? then @props.name else 'Anonymous ' + random_numbers(4)
   video = if @props.video? then @props.video else true
   audio = if @props.audio? then @props.audio else true
+
+  if not tawk.janus_initialized
+    initialize_janus(tawk.id, tawk.space)
+    tawk.janus_initialized = true
 
   # Have to make sure we get all connections to choose
   # whether to join the first group

                  room: 1234
                  ptype: "publisher"
                  display: JSON.stringify
                    id: my_id
                    space: my_space
            onmessage: (msg, jsep) ->
              # Janus is informing us of publishers we do not know about
              publishers = msg["publishers"] or []
              for feed in publishers
                {id, space} = JSON.parse feed.display
                if space == my_space
                  new_remote_feed janus, feed

              # The plugin_handle.send call to join as a publisher succeeded.

          janus.attach
            plugin: "janus.plugin.videoroom"
            error: console.error
            onlocalstream: (stream) -> recieved_stream(stream, tawk.id)
            success: (ph) ->
              # Join plugin as a publisher (able to both send and receive streams)
              plugin_handle = ph
