### Start ssb-server with Info Logging Source: https://github.com/ssbc/ssb-server/blob/main/README.md Starts the ssb-server with increased log detail for debugging purposes. This should be left running in a separate terminal. ```bash ssb-server start --logging.level=info ``` -------------------------------- ### Install ssb-server Globally Source: https://github.com/ssbc/ssb-server/blob/main/README.md Installs the ssb-server package globally, making its CLI commands available. Use --unsafe-perm if running as root. ```bash npm install -g ssb-server ``` -------------------------------- ### Install Node Version Manager (NVM) Source: https://github.com/ssbc/ssb-server/blob/main/README.md Installs NVM, a tool for managing Node.js versions. Run this script and then close and reopen your terminal. ```bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash ``` -------------------------------- ### Example SSB Room Connection String Source: https://github.com/ssbc/ssb-server/blob/main/__wiki__/ This is an example of a connection string for an SSB Room, including network address, transport protocol, and security details. It is used to connect to a specific room on the network. ```plaintext net:ssb-room.64-225-52-67.nip.io:8008~shs:uJXk9Aq2zRnIWUXipnDJkKsnLRzVoLGAY5SGaX3x1UY=:SSB+Room+PSK3TLYC2T86EHQCUHBUHASCASE18JBV24= ``` ```plaintext net:ssb-room.lohn.in:8006~shs:4FiUoVBSr0Byo2njngIrqUDs2QJOEzALzysYIuqQ4zA=:SSB+Room+PSK3TLYC2T86EHQCUHBUHASCASE18JBV24= ``` -------------------------------- ### Example SSB Pub Invite Code Source: https://github.com/ssbc/ssb-server/wiki/Pub-Servers An example of what an SSB pub invite code looks like. It contains the pub's address and a unique identifier. ```text foo.bar.co.nz:8009:@6lOh+rLq4MQubPQoKenbB827dh5NVc2FAjy30MTc08o=.ed25519~93RP4aT6YNm+7++Ab3VQd+w/CL2w6p8QuX7fRaUs9cY= ``` -------------------------------- ### Load NVM and Bash Completion Source: https://github.com/ssbc/ssb-server/blob/main/README.md Loads NVM and its bash completion script into your current terminal session. This is necessary after installing NVM. ```bash export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion ``` -------------------------------- ### Initialize and Configure ssb-server Source: https://github.com/ssbc/ssb-server/blob/main/README.md This snippet shows how to initialize ssb-server with plugins and save its manifest. It requires 'ssb-server', 'ssb-config', 'fs', and 'path'. ```js var Server = require('ssb-server') var config = require('ssb-config') var fs = require('fs') var path = require('path') // add plugins Server .use(require('ssb-master')) .use(require('ssb-gossip')) .use(require('ssb-replicate')) .use(require('ssb-backlinks')) var server = Server(config) // save an updated list of methods this server has made public // in a location that ssb-client will know to check var manifest = server.getManifest() fs.writeFileSync( path.join(config.path, 'manifest.json'), // ~/.ssb/manifest.json JSON.stringify(manifest) ) ``` -------------------------------- ### Configure ssb-server Connections Source: https://github.com/ssbc/ssb-server/blob/main/README.md Sets up the ssb-server configuration file to listen for incoming public connections on port 8008. ```json { "connections": { "incoming": { "net": [ { "scope": "public", "host": "0.0.0.0", "external": "Your Host Name or Public IP", "transform": "shs", "port": 8008 } ] }, "outgoing": { "net": [{ "transform": "shs" }] } } } ``` -------------------------------- ### Create a Script to Run ssb-server Source: https://github.com/ssbc/ssb-server/blob/main/README.md Creates a bash script that continuously runs the ssb-server, restarting it if it crashes. ```bash #!/bin/bash while true; do ssb-server start sleep 3 done ``` -------------------------------- ### Publish a Message via Command Line Source: https://github.com/ssbc/ssb-server/blob/main/README.md Use the 'ssb-server publish' command to post a message with a specified type and text. This is a direct way to interact with the server from the terminal. ```bash # publish a message ssb-server publish --type post --text "My First Post!" ``` -------------------------------- ### Connect and Publish a Message using ssb-client Source: https://github.com/ssbc/ssb-server/blob/main/README.md This Javascript snippet demonstrates connecting to a running ssb-server using 'ssb-client' and publishing a message. It requires 'pull-stream' and 'ssb-client'. ```js var pull = require('pull-stream') var Client = require('ssb-client') // create a ssb-server client using default settings // (server at localhost:8080, using key found at ~/.ssb/secret, and manifest we wrote to `~/.ssb/manifest.json` above) Client(function (err, server) { if (err) throw err // publish a message server.publish({ type: 'post', text: 'My First Post!' }, function (err, msg) { // msg.key == hash(msg.value) // msg.value.author == your id // msg.value.content == { type: 'post', text: 'My First Post!' } // ... }) }) ``` -------------------------------- ### Create Invite Codes Source: https://github.com/ssbc/ssb-server/blob/main/README.md Generates invite codes that can be shared with friends to allow them to connect to your ssb-server. ```bash ssb-server invite.create 1 ``` -------------------------------- ### Stream All Messages via Command Line (by Publish Time) Source: https://github.com/ssbc/ssb-server/blob/main/README.md The 'ssb-server feed' command streams all messages from all feeds, ordered by their publish time. This is useful for a chronological overview. ```bash # stream all messages in all feeds, ordered by publish time ssb-server feed ``` -------------------------------- ### Publish Pub Server Information Source: https://github.com/ssbc/ssb-server/blob/main/README.md Publishes 'about' information for your pub server, including its ID and a chosen name. ```bash ssb-server publish --type about --about {pub-id (this is the output from ssb-server whoami)} --name {Your pubs awesome name} ``` -------------------------------- ### Stream All Messages via Command Line (by Receive Time) Source: https://github.com/ssbc/ssb-server/blob/main/README.md Use 'ssb-server log' to stream all messages, ordered by when they were received. This provides a different perspective on message arrival. ```bash # stream all messages in all feeds, ordered by receive time ssb-server log ``` -------------------------------- ### Retrieve Public Rooms DNS TXT Record Source: https://github.com/ssbc/ssb-server/blob/main/__wiki__/ This command-line snippet shows how to retrieve a DNS TXT record containing a list of public SSB rooms using the 'host' utility on Linux. This is useful for discovering available rooms on the network. ```bash host -a -t TXT seeds.tildefriends.net ``` -------------------------------- ### scuttle.us Pub Invite Code Source: https://github.com/ssbc/ssb-server/wiki/Pub-Servers The invite code for the scuttle.us pub server. ```text scuttle.us:8008:@WqcuCOIpLtXFRw/9vOAQJti8avTZ9vxT9rKrPo8qG6o=.ed25519~/ZUi9Chpl0g1kuWSrmehq2EwMQeV0Pd+8xw8XhWuhLE= ``` -------------------------------- ### Stream All Messages using ssb-client (by Receive Time) Source: https://github.com/ssbc/ssb-server/blob/main/README.md This Javascript snippet demonstrates streaming all messages, ordered by receive time, using 'ssb-client' and 'pull-stream'. ```js // stream all messages in all feeds, ordered by receive time pull( server.createLogStream(), pull.collect(function (err, msgs) { // msgs[0].key == hash(msgs[0].value) // msgs[0].value... }) ) ``` -------------------------------- ### Stream All Messages using ssb-client (by Publish Time) Source: https://github.com/ssbc/ssb-server/blob/main/README.md This Javascript snippet shows how to stream all messages from all feeds, ordered by publish time, using 'ssb-client' and 'pull-stream'. ```js // stream all messages in all feeds, ordered by publish time pull( server.createFeedStream(), pull.collect(function (err, msgs) { // msgs[0].key == hash(msgs[0].value) // msgs[0].value... }) ) ``` -------------------------------- ### Stream Messages by Feed via Command Line Source: https://github.com/ssbc/ssb-server/blob/main/README.md The 'ssb-server hist --id $FEED_ID' command streams messages from a specific feed, ordered by sequence number. Replace $FEED_ID with the target feed's ID. ```bash # stream all messages by one feed, ordered by sequence number ssb-server hist --id $FEED_ID ``` -------------------------------- ### Stream Messages by Feed using ssb-client Source: https://github.com/ssbc/ssb-server/blob/main/README.md This Javascript snippet shows how to stream messages from a specific feed, ordered by sequence number, using 'ssb-client' and 'pull-stream'. Replace with the target feed's ID. ```js // stream all messages by one feed, ordered by sequence number pull( server.createHistoryStream({ id: < feedId > }), pull.collect(function (err, msgs) { // msgs[0].key == hash(msgs[0].value) // msgs[0].value... }) ) ``` -------------------------------- ### La Plaza Pub Invite Code Source: https://github.com/ssbc/ssb-server/wiki/Pub-Servers The invite code for the La Plaza pub server. ```text solarnethub.com:8008:@1wOEiCjJJ0nEs1OABUIV20valZ1LHUsfHJY/ivBoM8Y=.ed25519~/r4Z7VSML2zV1quwBdiyRy6e1j+CqDhagkbJOEbpc4g= ``` -------------------------------- ### FreeSocial Pub Invite Code Source: https://github.com/ssbc/ssb-server/wiki/Pub-Servers The invite code for the FreeSocial pub server. ```text pub.freesocial.co:8008:@ofYKOy2p9wsaxV73GqgOyh6C6nRGFM5FyciQyxwBd6A=.ed25519~ye9Z808S3KPQsV0MWr1HL0/Sh8boSEwW+ZK+8x85u9w= ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.