func (c *connection) subUnconfirmed() {
	byt := []byte(`{"op": "unconfirmed_sub"}`)
	c.send(websocket.TextMessage, byt)
	c.read()
}
Subscribe to new unconfirmed transactions.
package main
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"time"
	"strings"
	"github.com/gorilla/websocket"
)
const (
	PingInterval = time.Second * 30
	Url          = "wss://ws.blockchain.info:443/inv"
	Usage        = `
	  Usage:
	  	bithook <command> [webhook-url]
		bithook blocks -- Subscribe to new blocks.
		bithook unconfirmed -- Subscribe to new unconfirmed transactions.
		bithook address <address> -- Subscribe to address.
		bithook test -- Receives latest transaction. Use for testing.
		bithook help -- This help menu.
		bithook version -- This version.
	`
	Version = "0.0.2"
)
var webhookFlag string
type connection struct {
	ws   *websocket.Conn
	conn *websocket.Dialer
}
type response struct {
	Data map[string]interface{} `json:"data"`
}
func init() {
	if len(os.Args[1:]) < 1 {
		fmt.Println("Please enter a command.")
		fmt.Println(Usage)
		os.Exit(1)
	}
	hasWebhook := strings.HasPrefix(os.Args[len(os.Args)-1], "http")
	if hasWebhook {
		webhookFlag = os.Args[len(os.Args)-1]
	}
}
func (c *connection) send(messageType int, payload []byte) {
	fmt.Printf("Send: %s\n", payload)
	c.ws.WriteMessage(messageType, payload)
}
func (c *connection) subAddress(addr string) {
	addrStr := fmt.Sprintf(`{"op": "addr_sub", "addr": "%s"}`, addr)
	byt := []byte(addrStr)
	c.send(websocket.TextMessage, byt)
	c.read()
}
func (c *connection) subBlocks() {
	byt := []byte(`{"op": "blocks_sub"}`)
	c.send(websocket.TextMessage, byt)
	c.read()
}