Skip to content

Commit

Permalink
docs(pubsub): web copy
Browse files Browse the repository at this point in the history
  • Loading branch information
neurosnap committed Sep 8, 2024
1 parent 85bbfc5 commit fdadd78
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions pubsub/html/marketing.page.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{template "base" .}}

{{define "title"}}{{.Site.Domain}} -- pubsub using ssh{{end}}
{{define "title"}}pubsub using ssh{{end}}

{{define "meta"}}
<meta name="description" content="pubsub using ssh" />
Expand Down Expand Up @@ -39,8 +39,8 @@
user-defined channels. Channels are private to the authenticated
ssh user. The default pubsub model is multicast with bidirectional
blocking, meaning a publisher (<code>pub</code>) will send its message to all
subscribers (<code>sub</code>). Further, both <code>pub</code> and
<code>sub</code> will wait for at least one event to be sent or received.
subscribers (<code>sub</code>) on a channel. Further, both <code>pub</code> and
<code>sub</code> will wait for at least one event to be sent or received on the channel.
</p>

<div>
Expand All @@ -51,21 +51,29 @@

<div>
<h2 class="text-xl">Simple desktop notifications</h2>
<pre>ssh {{.Site.Domain}} sub notify | notify-send</pre>
<pre>./longjob.sh; echo "Job done!" | ssh {{.Site.Domain}} pub notify</pre>
<pre>ssh {{.Site.Domain}} sub notify | notify-send "job done!"</pre>
<pre>./longjob.sh; ssh {{.Site.Domain}} pub notify -e</pre>
</div>

<div>
<h2 class="text-xl">Simple CI/CD</h2>
<pre>ssh {{.Site.Domain}} sub myimg | docker pull myimg && docker up -d dev</pre>
<pre>docker buildx build --push -t myimg .; ssh {{.Site.Domain}} pub myimg</pre>
<pre>docker buildx build --push -t myimg .; ssh {{.Site.Domain}} pub myimg -e</pre>
</div>

<div>
<h2 class="text-xl">Send a public message</h2>
<pre>echo "hello world!" | ssh send.pico.sh pub mychan -p</pre>
<p>Now anyone with a <code>pico</code> can subscribe to this channel:</p>
<pre>ssh send.pico.sh sub mychan -p</pre>
</div>

<div>
<h2 class="text-xl">Caveats</h2>
<p>
You must always pipe something into <code>pub</code> or else it will block
indefinitely until the process is killed.
indefinitely until the process is killed. However, you can provide a
flag to send an empty message: <code>pub xyz -e</code>.
</p>
</div>

Expand Down

0 comments on commit fdadd78

Please sign in to comment.