Giter Club home page Giter Club logo

pusher-http-go's Introduction

Pusher Channels HTTP Go Library

Build Status Coverage Status Go Reference

The Golang library for interacting with the Pusher Channels HTTP API.

This package lets you trigger events to your client and query the state of your Pusher channels. When used with a server, you can validate Pusher Channels webhooks and authorize private- or presence- channels.

Register for free at https://pusher.com/channels and use the application credentials within your app as shown below.

Supported Platforms

  • Go - supports Go 1.11 or greater.

Table of Contents

Installation

$ go get github.com/pusher/pusher-http-go/v5

Getting Started

package main

import (
  "github.com/pusher/pusher-http-go/v5"
)

func main(){
    // instantiate a client
    pusherClient := pusher.Client{
        AppID:   "APP_ID",
        Key:     "APP_KEY",
        Secret:  "APP_SECRET",
        Cluster: "APP_CLUSTER",
    }

    data := map[string]string{"message": "hello world"}

    // trigger an event on a channel, along with a data payload
    err := pusherClient.Trigger("my-channel", "my_event", data)

    // All trigger methods return an error object, it's worth at least logging this!
    if err != nil {
        panic(err)
    }
}

Configuration

The easiest way to configure the library is by creating a new Pusher instance:

pusherClient := pusher.Client{
    AppID:   "APP_ID",
    Key:     "APP_KEY",
    Secret:  "APP_SECRET",
    Cluster: "APP_CLUSTER",
}

Additional options

Instantiation From URL

pusherClient := pusher.ClientFromURL("http://<key>:<secret>@api-<cluster>.pusher.com/apps/app_id")

Note: the API URL differs depending on the cluster your app was created in:

http://key:[email protected]/apps/app_id
http://key:[email protected]/apps/app_id

Instantiation From Environment Variable

pusherClient := pusher.ClientFromEnv("PUSHER_URL")

This is particularly relevant if you are using Pusher Channels as a Heroku add-on, which stores credentials in a "PUSHER_URL" environment variable.

HTTPS

To ensure requests occur over HTTPS, set the Secure property of a pusher.Client to true.

pusherClient.Secure = true

This is false by default.

Request Timeouts

If you wish to set a time-limit for each HTTP request, create a http.Client instance with your specified Timeout field and set it as the Pusher Channels instance's Client:

httpClient := &http.Client{Timeout: time.Second * 3}

pusherClient.HTTPClient = httpClient

If you do not specifically set a HTTP client, a default one is created with a timeout of 5 seconds.

Changing Host

Changing the pusher.Client's Host property will make sure requests are sent to your specified host.

pusherClient.Host = "foo.bar.com"

By default, this is "api.pusherapp.com".

Changing the Cluster

Setting the pusher.Client's Cluster property will make sure requests are sent to the cluster where you created your app.

NOTE! If Host is set then Cluster will be ignored.

pusherClient.Cluster = "eu" // in this case requests will be made to api-eu.pusher.com.

End to End Encryption

This library supports end to end encryption of your private channels. This means that only you and your connected clients will be able to read your messages. Pusher cannot decrypt them. You can enable this feature by following these steps:

  1. You should first set up Private channels. This involves creating an authorization endpoint on your server.

  2. Next, generate a 32 byte master encryption key, base64 encode it and store it securely.

    This is secret and you should never share this with anyone. Not even Pusher.

    To generate a suitable key from a secure random source, you could use:

    openssl rand -base64 32
  3. Pass the encoded key when constructing your pusher.Client

    pusherClient := pusher.Client{
        AppID:                    "APP_ID",
        Key:                      "APP_KEY",
        Secret:                   "APP_SECRET",
        Cluster:                  "APP_CLUSTER",
        EncryptionMasterKeyBase64 "<output from command above>",
    }
  4. Channels where you wish to use end to end encryption should be prefixed with private-encrypted-.

  5. Subscribe to these channels in your client, and you're done! You can verify it is working by checking out the debug console on the https://dashboard.pusher.com/ and seeing the scrambled ciphertext.

Important note: This will not encrypt messages on channels that are not prefixed by private-encrypted-.

Google App Engine

As of version 1.0.0, this library is compatible with Google App Engine's urlfetch library. Pass in the HTTP client returned by urlfetch.Client to your Pusher Channels initialization struct.

package helloworldapp

import (
    "appengine"
    "appengine/urlfetch"
    "fmt"
    "github.com/pusher/pusher-http-go/v5"
    "net/http"
)

func init() {
    http.HandleFunc("/", handler)
}

func handler(w http.ResponseWriter, r *http.Request) {
    c := appengine.NewContext(r)
    urlfetchClient := urlfetch.Client(c)

    pusherClient := pusher.Client{
        AppID:      "APP_ID",
        Key:        "APP_KEY",
        Secret:     "APP_SECRET",
        HTTPClient: urlfetchClient,
    }

    pusherClient.Trigger("my-channel", "my_event", map[string]string{"message": "hello world"})

    fmt.Fprint(w, "Hello, world!")
}

Usage

Triggering events

It is possible to trigger an event on one or more channels. Channel names can contain only characters which are alphanumeric, _ or - and have to be at most 200 characters long. Event name can be at most 200 characters long too.

Custom Types

pusher.Event

type TriggerParams struct {
    SocketID *string
    Info     *string
}

Note: Info is part of an experimental feature.

Single channel

func (c *Client) Trigger
Argument Description
channel string The name of the channel you wish to trigger on.
event string The name of the event you wish to trigger.
data interface{} The payload you wish to send. Must be marshallable into JSON.
Example
data := map[string]string{"hello": "world"}
pusherClient.Trigger("greeting_channel", "say_hello", data)
func (c *Client) TriggerWithParams

Allows additional parameters to be included as part of the request body. The complete list of parameters are documented here.

Argument Description
channel string The name of the channel you wish to trigger on.
event string The name of the event you wish to trigger.
data interface{} The payload you wish to send. Must be marshallable into JSON.
params TriggerParams Any additional parameters.
Return Value Description
channels TriggerChannelsList A struct representing channel attributes for the requested TriggerParams.Info
err error Any errors encountered
Example
data := map[string]string{"hello": "world"}
socketID := "1234.12"
attributes := "user_count"
params := pusher.TriggerParams{SocketID: &socketID, Info: &attributes}
channels, err := pusherClient.TriggerWithParams("presence-chatroom", "say_hello", data, params)

// channels => &{Channels:map[presence-chatroom:{UserCount:4}]}

Multiple channels

func (c. *Client) TriggerMulti
Argument Description
channels []string A slice of channel names you wish to send an event on. The maximum length is 10.
event string As above.
data interface{} As above.
Example
pusherClient.TriggerMulti([]string{"a_channel", "another_channel"}, "event", data)
func (c. *Client) TriggerMultiWithParams
Argument Description
channels []string A slice of channel names you wish to send an event on. The maximum length is 10.
event string As above.
data interface{} As above.
params TriggerParams As above.
Return Value Description
channels TriggerChannelsList A struct representing channel attributes for the requested TriggerParams.Info
err error Any errors encountered
Example
data := map[string]string{"hello": "world"}
socketID := "1234.12"
attributes := "user_count"
params := pusher.TriggerParams{SocketID: &socketID, Info: &attributes}
channels, err := pusherClient.TriggerMultiWithParams([]string{"presence-chatroom", "presence-notifications"}, "event", data, params)

// channels => &{Channels:map[presence-chatroom:{UserCount:4} presence-notifications:{UserCount:31}]}

Batches

func (c. *Client) TriggerBatch
Argument Description
batch []Event A list of events to publish
Return Value Description
batch TriggerBatchChannelsList A struct representing channel attributes for the requested TriggerParams.Info
err error Any errors encountered
Custom Types

pusher.Event

type Event struct {
    Channel  string
    Name     string
    Data     interface{}
    SocketID *string
    Info     *string
}

Note: Info is part of an experimental feature.

Example
socketID := "1234.12"
attributes := "user_count"
batch := []pusher.Event{
  { Channel: "a-channel", Name: "event", Data: "hello world" },
  { Channel: "presence-b-channel", Name: "event", Data: "hi my name is bob", SocketID: &socketID, Info: &attributes },
}
response, err := pusherClient.TriggerBatch(batch)

for i, attributes := range response.Batch {
    if attributes.UserCount != nil {
        fmt.Printf("channel: %s, name: %s, user_count: %d\n", batch[i].Channel, batch[i].Name, *attributes.UserCount)
    } else {
        fmt.Printf("channel: %s, name: %s\n", batch[i].Channel, batch[i].Name)
    }
}

// channel: a-channel, name: event
// channel: presence-b-channel, name: event, user_count: 4

Send to user

func (c *Client) SendToUser
Argument Description
userId string The id of the user who should receive the event.
event string The name of the event you wish to trigger.
data interface{} The payload you wish to send. Must be marshallable into JSON.
Example
data := map[string]string{"hello": "world"}
pusherClient.SendToUser("user123", "say_hello", data)

Authenticating Users

Pusher Channels provides a mechanism for authenticating users. This can be used to send messages to specific users based on user id and to terminate misbehaving user connections, for example.

For more information see our docs.

func (c *Client) AuthenticateUser

Argument Description
params []byte The request body sent by the client
userData map[string]interface{} The map containing arbitrary user data. It must contain at least an id field with the user's id as a string. See below.
Arbitrary User Data
userData := map[string]interface{} { "id": "1234", "twitter": "jamiepatel" }
Return Value Description
response []byte The response to send back to the client, carrying an authentication signature
err error Any errors generated
Example
func pusherUserAuth(res http.ResponseWriter, req *http.Request) {
    params, _ := ioutil.ReadAll(req.Body)
    userData := map[string]interface{} { "id": "1234", "twitter": "jamiepatel" }
    response, err := pusherClient.AuthenticateUser(params, userData)
    if err != nil {
        panic(err)
    }

    fmt.Fprintf(res, string(response))
}

func main() {
    http.HandleFunc("/pusher/user-auth", pusherUserAuth)
    http.ListenAndServe(":5000", nil)
}

Authorizing Channels

Application security is very important so Pusher Channels provides a mechanism for authorizing a user’s access to a channel at the point of subscription.

This can be used both to restrict access to private channels, and in the case of presence channels notify subscribers of who else is also subscribed via presence events.

This library provides a mechanism for generating an authorization signature to send back to the client and authorize them.

For more information see our docs.

Private channels

func (c *Client) AuthorizePrivateChannel
Argument Description
params []byte The request body sent by the client
Return Value Description
response []byte The response to send back to the client, carrying an authorization signature
err error Any errors generated
Example
func pusherAuth(res http.ResponseWriter, req *http.Request) {
    params, _ := ioutil.ReadAll(req.Body)
    response, err := pusherClient.AuthorizePrivateChannel(params)
    if err != nil {
        panic(err)
    }

    fmt.Fprintf(res, string(response))
}

func main() {
    http.HandleFunc("/pusher/auth", pusherAuth)
    http.ListenAndServe(":5000", nil)
}
Example (JSONP)
func pusherJsonpAuth(res http.ResponseWriter, req *http.Request) {
    var (
        callback, params string
    )

    {
        q := r.URL.Query()
        callback = q.Get("callback")
        if callback == "" {
            panic("callback missing")
        }
        q.Del("callback")
        params = []byte(q.Encode())
    }

    response, err := pusherClient.AuthorizePrivateChannel(params)
    if err != nil {
        panic(err)
    }

    res.Header().Set("Content-Type", "application/javascript; charset=utf-8")
    fmt.Fprintf(res, "%s(%s);", callback, string(response))
}

func main() {
    http.HandleFunc("/pusher/auth", pusherJsonpAuth)
    http.ListenAndServe(":5000", nil)
}

Authorizing presence channels

Using presence channels is similar to private channels, but in order to identify a user, clients are sent a user_id and, optionally, custom data.

func (c *Client) AuthorizePresenceChannel
Argument Description
params []byte The request body sent by the client
member pusher.MemberData A struct representing what to assign to a channel member, consisting of a UserID and any custom UserInfo. See below
Custom Types

pusher.MemberData

type MemberData struct {
    UserID   string
    UserInfo map[string]string
}
Example
params, _ := ioutil.ReadAll(req.Body)

presenceData := pusher.MemberData{
    UserID: "1",
    UserInfo: map[string]string{
        "twitter": "jamiepatel",
    },
}

response, err := pusherClient.AuthorizePresenceChannel(params, presenceData)

if err != nil {
    panic(err)
}

fmt.Fprintf(res, response)

Application state

This library allows you to query our API to retrieve information about your application's channels, their individual properties, and, for presence-channels, the users currently subscribed to them.

Get the list of channels in an application

func (c *Client) Channels
Argument Description
params ChannelsParams The query options. The field FilterByPrefix will filter the returned channels. To get the number of users subscribed to a presence-channel, specify an the Info field with value "user_count". Pass in nil if you do not wish to specify any query attributes.
Return Value Description
channels ChannelsList A struct representing the list of channels. See below.
err error Any errors encountered
Custom Types

pusher.ChannelsParams

type ChannelsParams struct {
    FilterByPrefix *string
    Info           *string
}

pusher.ChannelsList

type ChannelsList struct {
    Channels map[string]ChannelListItem
}

pusher.ChannelsListItem

type ChannelListItem struct {
    UserCount int
}
Example
prefixFilter := "presence-"
attributes := "user_count"
params := pusher.ChannelsParams{FilterByPrefix: &prefixFilter, Info: &attributes}
channels, err := pusherClient.Channels(params)

// channels => &{Channels:map[presence-chatroom:{UserCount:4} presence-notifications:{UserCount:31}]}

Get the state of a single channel

func (c *Client) Channel
Argument Description
name string The name of the channel
params ChannelParams The query options. The field Info can have comma-separated values of "user_count", for presence-channels, and "subscription_count", for all-channels. To use the "subscription_count" value, first check the "Enable subscription counting" checkbox in your App Settings on your Pusher Channels dashboard. Pass in nil if you do not wish to specify any query attributes.
Return Value Description
channel Channel A struct representing a channel. See below.
err error Any errors encountered
Custom Types

pusher.ChannelParams

type Channel struct {
    Info *string
}

pusher.Channel

type Channel struct {
    Name              string
    Occupied          bool
    UserCount         int
    SubscriptionCount int
}
Example
attributes := "user_count,subscription_count"
params := pusher.ChannelParams{Info: &attributes}
channel, err := client.Channel("presence-chatroom", params)

// channel => &{Name:presence-chatroom Occupied:true UserCount:42 SubscriptionCount:42}

Get a list of users in a presence channel

func (c *Client) GetChannelUsers
Argument Description
name string The channel name
Return Value Description
users Users A struct representing a list of the users subscribed to the presence-channel. See below
err error Any errors encountered.
Custom Types

pusher.Users

type Users struct {
    List []User
}

pusher.User

type User struct {
    ID string
}
Example
users, err := pusherClient.GetChannelUsers("presence-chatroom")

// users => &{List:[{ID:13} {ID:90}]}

Webhook validation

On your dashboard, you can set up webhooks to POST a payload to your server after certain events. Such events include channels being occupied or vacated, members being added or removed in presence-channels, or after client-originated events. For more information see https://pusher.com/docs/webhooks.

This library provides a mechanism for checking that these POST requests are indeed from Pusher, by checking the token and authentication signature in the header of the request.

func (c *Client) Webhook
Argument Description
header http.Header The header of the request to verify
body []byte The body of the request
Return Value Description
webhook *pusher.Webhook If the webhook is valid, this method will return a representation of that webhook that includes its timestamp and associated events. If invalid, this value will be nil.
err error If the webhook is invalid, an error value will be passed.
Custom Types

pusher.Webhook

type Webhook struct {
    TimeMs int
    Events []WebhookEvent
}

pusher.WebhookEvent

type WebhookEvent struct {
    Name     string
    Channel  string
    Event    string
    Data     string
    SocketID string
}
Example
func pusherWebhook(res http.ResponseWriter, req *http.Request) {
    body, _ := ioutil.ReadAll(req.Body)
    webhook, err := pusherClient.Webhook(req.Header, body)
    if err != nil {
        fmt.Println("Webhook is invalid :(")
    } else {
        fmt.Printf("%+v\n", webhook.Events)
    }
}

Feature Support

Feature Supported
Trigger event on single channel
Trigger event on multiple channels
Trigger events in batches
Excluding recipients from events
Fetching info on trigger
Send to user
Authenticating users
Authorizing private channels
Authorizing presence channels
Get the list of channels in an application
Get the state of a single channel
Get a list of users in a presence channel
WebHook validation
Heroku add-on support
Debugging & Logging
Cluster configuration
Timeouts
HTTPS
HTTP Proxy configuration
HTTP KeepAlive

Helper Functionality

These are helpers that have been implemented to to ensure interactions with the HTTP API only occur if they will not be rejected e.g. channel naming conventions.

Helper Functionality Supported
Channel name validation
Limit to 10 channels per trigger
Limit event name length to 200 chars

Developing the Library

Feel more than free to fork this repo, improve it in any way you'd prefer, and send us a pull request :)

Running the tests

$ go test

License

This code is free to use under the terms of the MIT license.

pusher-http-go's People

Contributors

agatav avatar charlesworth avatar damdo avatar danielrbrowne avatar iwanbk avatar jameshfisher avatar jpatel531 avatar kn100 avatar leesio avatar lukabratos avatar mdpye avatar pyjac avatar samuelyallop-pusher avatar sonologico avatar topliceanu avatar vivangkumar avatar vivienschilis avatar willsewell avatar zimbatm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pusher-http-go's Issues

No easily mockable

I am currently working with this library and wanted to add it to my tests.
Unfortunately because there is no interface the only way to test this client is to
actually hook into a real pusher client.

Would it be reasonable to add an interface definition to the Client or at the very least
provide a NoOp client that returns common calls such as Trigger() with no errors?

I am open to suggestions as well in case I have an oversight.

Also, not just gonna request, but happy to try and contribute to this if it seems like a reasonable idea.

Introducing Breaking Changes

You changed AppId to AppID and also UserId to UserID and it took me hours to figure out why my deployments weren't working. Come on guys lets not introduce breaking changes like this without some sort of heads up!

Current design doesn't allow switching the http client

Some environments doesn't support the default http client (like Google App Engine).
Current design makes it difficult to switch out the http client.

The workaround is currently to switch only the underlying transport if this is enough by:
client.HttpClient().Transport = urlfetch.Client(c).Transport

This is related to: #5

Push notifications key names should correspond to GCM/APNs docs

I don't understand why our naming scheme doesn't correspond to the names in the GCM/APNs request, e.g. "Payload" becomes "notification" https://github.com/pusher/pusher-http-go/blob/new-lib/notifications.go#L56 I think we want people to be able to refer to GCM/APNs docs to figure out what to send.

I'd also suggest just letting people pass a map[string]interface{} instead of our own internal representation of notifications. We do this in the other HTTP libs. The current method will mean constantly monitoring GCM/APNs for new features they add, and then including them here.

Suggestion: expose function to manually pass channel name and socket ID for authentication

If I'm correct, AuthenticatePrivateChannel is the only way to compute the auth token.

Other official libraries, include something like:

var auth = pusher.authenticate(socketId, channel);

See: https://github.com/pusher/pusher-http-node#authenticating-private-channels

Right now, if I want to perform some basic checks on the channel name, I need to replicate the byte parsing logic that AuthenticatePrivateChannel does internally in

func parseAuthRequestParams(_params []byte) (channelName string, socketID string, err error) {

Timeout cannot be set to 0

Current design doesn't allow setting the clients timeout to 0.
It is always overridden by the default 5 seconds.

This is a problem if the http transport in use doesn't support CancelRequest as in googles app engine.

Auth value for subscription to private-chat-room is invalid

hello I'm facing a problem when trying to access a private channel

I created the same authentication route as in the documentation example

	app.Post("pusher/auth", func(c *fiber.Ctx) error {
		
		var pusherClient pusher.Client
		response, err := pusherClient.AuthorizePrivateChannel(c.Body())

		if err != nil {
			fmt.Println(err)
		}

		return c.JSON(fiber.Map{"auth": response})
	})

it returns the token correctly but when it returns the following error

send token

{"event":"pusher:subscribe","data":{"auth":"eyJhdXRoIjoiOjJlMTcxYjJmZTc3ZDE0NjQ1ZTMyMzQzNGQ1YWFiMjhiZWVlMmYzYmI4OGJmMTdhNzU4YmRjODYxZWI0NGI3NzUifQ==","channel":"private-chat-room"}}

error code

{"event":"pusher:error","data":{"code":null,"message":"Auth value for subscription to private-chat-room is invalid: should be of format 'key:signature'"}}

it asks for a token with the pre-fixed app-key: but I couldn't contact it because the token comes in a byte slice type

No example of using the return value of Trigger(...)

All examples allow errors to silently fail. For example, I was only able to reveal a failure the following failure by reading the returned error.

Post https://api-eu.pusher.com/apps/449839/events?...: x509: failed to load system roots and no roots provided

"Trigger()" function returning error on deployed backend - "Invalid signature: you should have sent HmacSHA256Hex"

I have a basic go backend deployed on fly.io that serves a POST route that takes a Message, and calls the Trigger function, which would get picked up by my front end and displayed on the screen. During local development, this workflow works perfectly, but calling the POST route on the api at the deployed URL produces the following error:

Status Code: 401 - Invalid signature: you should have sent HmacSHA256Hex("POST\n/apps/PUSHER_APPID/events\nauth_key=PUSHER_KEY&auth_timestamp=1701978133&auth_version=1.0&body_md5=5c97a1d17397906fcfbfb622622a2b59", your_secret_key), but you sent "e2abd797832ba0fe963c77dd2656aae135a2bd2e45afc9d419ac3a7e2ae59765"

func (m *MessageController) PostMessage(c *fiber.Ctx) error{
	message := models.Message{}

	if err := c.BodyParser(&message); err != nil{
		c.Smetatus(http.StatusInternalServerError).JSON(err)
	}

	if err := message.Validate(); err != nil{
		c.Status(http.StatusBadRequest).JSON(err)
	}

	message.MessageDate = time.Now().Format("2006-01-02 3:4:5 pm")
	err := m.pusherClient.Trigger("public", "public_message", message)

	if err != nil{
		fmt.Println("err broadcasting messages:", err) //Error is thrown right here, and message is not broadcasted.
	}
	
	return c.Status(http.StatusOK).JSON(message)
}

What's causing this error? It only happens when calling the route on the deployed API, but when calling the same route locally, the message is broadcasted normally, and the error is not thrown.

What about Receiving Pusher events

hi,
I also like to be able to receive pusher events in my golang app (ie. just like the Browser client). Is that possible with this lib?

thanks,
eddie

pusherClient.SendToUser

How can i push to a specific user in Go? The documentation states that I should use pusherClient.SendToUser but get this error instead:

pusherClient.SendToUser undefined (type pusher.Client has no field or method SendToUser)

timeouts

Hello,
I've got the following quite often:

request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

Where timeout could come from?

thank you

Trigger with []byte array of marshalled json

Is it possible to trigger an event using marshaled json object bytes as the payload. I would like to keep my event listener abstract and not have to marshal specific JSON structs

EOF

We intermittently see following error getting logged when we trigger events.

Post https://api-us2.pusher.com/apps/1XXXXX6/events?auth_key=19bd1b73XXXXXXXX&auth_signature=7ce8211106858e786ee7eb845b0ef0f7d0b865f8d7423c3564157e0b021d7dcf&auth_timestamp=1683258823&auth_version=1.0&body_md5=a686c9c9547815b9420a584506fe12c6: EOF

The error just say Post <URL>: EOF - no further info, these errors are not even listed in dashboard.
Following is an example of payload posted

map[string]string{
	"UUID": "65d3debf-e7c0-4d49-bbe8-75a1b2eeeeb3",
	"key1": "5YJSA1E66MF441339",
	"key2": "false",
	"key3": "false",
	"updatedAt": "2023-05-05T07:18:54Z",
}

Version being used : github.com/pusher/pusher-http-go/v5 v5.1.1

Shared http.Client 4 all

It struck me, if a http.Client where to be embedded in the pusher.Client struct it would be available for configuration and also shared between requests. It means the connection can stay open and use http pipelining. Does it make sense to you @jpatel531 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.