An open source Pusher server implementation compatible with Pusher client libraries written in GO

Go Report Card

Try browsing the code on Sourcegraph!

IPÊ

An open source Pusher server implementation compatible with Pusher client libraries written in Go.

Why I wrote this software?

  1. I wanted to learn Go and I needed a non trivial application;
  2. I use Pusher in some projects;
  3. I really like Pusher;
  4. I was using Pusher on some projects behind a firewall;

Features

  • Public Channels;
  • Private Channels;
  • Presence Channels;
  • Web Hooks;
  • Client events;
  • Complete REST API;
  • Easy installation;
  • A single binary without dependencies;
  • Easy configuration;
  • Protocol version 7;
  • Multiple apps in the same instance;
  • Drop in replacement for pusher server;

Download pre built binaries

You can download pre built binaries from the releases tab.

Building

$ go get github.com/dimiro1/ipe

or simply

$ go install github.com/dimiro1/ipe

Building from a local checkout

$ git clone https://github.com/dimiro1/ipe.git
$ cd ipe/cmd
$ go build -o ipe

How to configure?

The server

---
host: ":8080"
profiling: false
ssl:
  enabled: false
  host: ":4343"
  key_file: "key.pem"
  cert_file: "cert.pem"
apps:
  - name: "Sample Application"
    enabled: true
    only_ssl: false
    key: "278d525bdf162c739803"
    secret: "${APP_SECRET}" # Expand env vars
    app_id: "1"
    user_events: true
    webhooks:
      enabled: true
      url: "http://127.0.0.1:5000/hook"

Libraries

Client javascript library

let pusher = new Pusher(APP_KEY, {
  wsHost: 'localhost',
  wsPort: 8080,
  wssPort: 4433,    // Required if encrypted is true
  encrypted: false, // Optional. the application must use only SSL connections
  enabledTransports: ["ws", "flash"],
  disabledTransports: ["flash"]
});

Client server libraries

Ruby

Pusher.host = 'localhost'
Pusher.port = 8080

PHP

$pusher = new Pusher(APP_KEY, APP_SECRET, APP_ID, DEBUG, "http://localhost", "8080");

Go

package main

import "github.com/pusher/pusher-http-go"

func main() {
	client := pusher.Client{
        AppId:  "APP_ID",
        Key:    "APP_KEY",
        Secret: "APP_SECRET",
        Host:   ":8080",
    }
	
	// use the client
}

NodeJS

let pusher = new Pusher({
  appId: APP_ID,
  key: APP_KEY,
  secret: APP_SECRET
  domain: 'localhost',
  port: 80
});

Logging

This software uses the glog library

for more information about logging type the following in console.

$ ipe -h

When use this software?

  • When you are offline;
  • When you want to control your infrastructure;
  • When you do not want to have external dependencies;
  • When you want extend the protocol;

Contributing.

Feel free to fork this repo.

Pusher

Pusher is an excellent service, their service is very reliable. I recommend for everyone.

Where this name came from?

Here in Brazil we have this beautiful tree called Ipê, it comes in differente colors: yellow, pink, white, purple.

I want to see pictures

Author

Claudemiro Alves Feitosa Neto

LICENSE

Copyright 2014, 2018 Claudemiro Alves Feitosa Neto. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Owner
Claudemiro
@golang, @python developer, but can work well with Java and @nodejs.
Claudemiro
Comments
  • Update build instructions

    Update build instructions

    Hi,

    First thanks for implementing ipe !

    I'm trying to build it on a i386 arch, I'm totally new to the go ecosystem, so I just followed the README and this is what I get:

    $ go get github.com/dimiro1/ipe
    package ipe/api: unrecognized import path "ipe/api" (import path does not begin with hostname)
    package ipe/app: unrecognized import path "ipe/app" (import path does not begin with hostname)
    package ipe/config: unrecognized import path "ipe/config" (import path does not begin with hostname)
    package ipe/storage: unrecognized import path "ipe/storage" (import path does not begin with hostname)
    package ipe/websockets: unrecognized import path "ipe/websockets" (import path does not begin with hostname)
    

    Naively I spent some time fixing import pathes, but the best I could get is a ipe.a file in ~/.go/pkg.

    Could you please give me the instructions on how to build an ipe binary similar to the one you distribute as binary ?

    (Note: I had no luck either on a amd64 machine).

    Regards.

  • SSL Implementation

    SSL Implementation

    This is an early stage implementation in order to resolve #8. It implements support of secure connections between clients and ipe server. The folowing keys were added in server configuration in order to setup a secure server:

    {
        "Encrypted": true,
        "SSLPrivateKey": "/home/ssl.key",
        "SSLPublicKey": "/home/ssl.crt"
    }
    

    As in Pusher, the clients must be configured to use secure connection too by providing the options encrypted and wssPort

  • Why do we need to run functional/client.go manually?

    Why do we need to run functional/client.go manually?

    There is a webhooks config option in config.yml file, but I don't see it starts automatically in main.go. I compile and run ipe from go command line, didn't execute any docker command or bash script. I need to manually run functional/client.go to handle client auth connections. Did I do it wrong? Is there other options?

  • How do you suppose to write an SQL implementation of db.go ?

    How do you suppose to write an SQL implementation of db.go ?

    I did write one and all interface functions worked perfectly, these:

        GetAppByAppID(appID string) (*app, error)
        GetAppByKey(key string) (*app, error)
        AddApp(*app) error
    

    However, the following from the app struct should be kept in memory for all apps at all times IMO:

        Channels    map[string]*channel
        Connections map[string]*connection
    
        Stats *expvar.Map
    

    You don't really think these should be serialized and saved to the database as well? (and when to save these? when anything inside these changes???)

    IMO, only these should be stored in the database from the app struct::

        Name                string
        AppID               string
        Key                 string
        Secret              string
        OnlySSL             bool
        ApplicationDisabled bool
        UserEvents          bool
        WebHooks            bool
        URLWebHook          string
    

    and when these get updated in the database then we should re-read these (maybe check for db changes periodically from a go routine) and update the in-memory database with the new values. When we do this updating, we should never touch the app's Channels, Connections and Stats in memory, I think.

    What is your opinion on this? How do you suppose to store the AppIDs and the other app data in an SQL database with the current Ipe code base? IMO, some restructuring might be needed for this.

  • Presence channels subscribe fails with int userID

    Presence channels subscribe fails with int userID

    Hi, is there a way we could process integer as userId on channel subscribe here? If u'll point me in right direction i can submit PR My current problem is that my vendor (laravel) provides this key as int, and i can only affect userInfo field inside my project source files, so i'm hitting this err 8 channel.go:174] json: cannot unmarshal number into Go struct field .user_id of type string

  • Ping addition

    Ping addition

    Added a ping timer and a pong timeout using pusher:ping and pusher:pong events. In case of no pong received in time, client is properly disconnected. The Ticker is set to 120 sec (the usual application_timeout) and the Timer for pong timeout is set to 10 seconds.

    Added an ' ^ ' to IPÊ in ASCII art.

  • cross compilation / build

    cross compilation / build

    Hi, i saw on the readme that you can't provide windows relase since you didn't own a windows machine, but as referenced in this blog post that it is possible to do a cross build for other os and architecture.

    i've tried it myself, and ipe seems to run okay on windows (didn't have a chance to test the functionality, since it's on a friend's computer). Is there any possibilty to add the windows release for future release? or is there any problem with compiling it that way? (I'm sorry if this sounds stupid, i'm just starting to learn go lang)

  • 在windows下面测试,如果同时开上几个浏览器不断刷新进行连接会卡死

    在windows下面测试,如果同时开上几个浏览器不断刷新进行连接会卡死

    2016/08/27 02:26:14 http: response.WriteHeader on hijacked connection 2016/08/27 02:26:14 http: response.Write on hijacked connection

    image

    我不太懂英文,所以没办法用英文交流,很抱歉,希望可以解决

  • Do not overuse defer unnecessarily

    Do not overuse defer unnecessarily

    It is a bit better IMO to not use defer for mutex Lock/Unlock because we should release the lock as soon as possible, not just at the very end of the function via defer. Program code is better readable this way, too. (I know, there are cases when using defer is better, this is just not such a case.)

  • Use secure connection for Ipe server

    Use secure connection for Ipe server

    Hi, not sure if it's an issue but.. is it possible to use a secure connection for the Ipe server? If so, how can I configure it? I couldn't find it anywhere.

  • Future of this package

    Future of this package

    I am looking for a pusher replacement package at the moment when i came across this one. It looks like the development was very active a year ago but seems it stopped there.

    Just asking if it is abandoned and i must look further, or can i safely use this in production?

Tiny structured logging abstraction or facade for various logging libraries, allowing the end user to plug in the desired logging library in main.go
Tiny structured logging abstraction or facade for various logging libraries, allowing the end user to plug in the desired logging library in main.go

Tiny structured logging abstraction or facade for various logging libraries, allowing the end user to plug in the desired logging library in main.go.

Dec 7, 2022
Open source framework for processing, monitoring, and alerting on time series data

Kapacitor Open source framework for processing, monitoring, and alerting on time series data Installation Kapacitor has two binaries: kapacitor – a CL

Dec 26, 2022
An Open Source video surveillance management system for people making this world a safer place.
An Open Source video surveillance management system for people making this world a safer place.

Kerberos Open Source Docker Hub | Documentation | Website Kerberos Open source (v3) is a cutting edge video surveillance management system made availa

Dec 30, 2022
An open-source and enterprise-level monitoring system.
 An open-source and enterprise-level monitoring system.

Falcon+ Documentations Usage Open-Falcon API Prerequisite Git >= 1.7.5 Go >= 1.6 Getting Started Docker Please refer to ./docker/README.md. Build from

Jan 1, 2023
Open Source Supreme Monitor Based on GoLang

Open Source Supreme Monitor Based on GoLang A module built for personal use but ended up being worthy to have it open sourced.

Nov 4, 2022
Open Source Software monitoring platform tools.

ByteOpen Open Source Software monitoring platform tools. Usage Clone the repo to your own go src path cd ~/go/src git clone https://code.byted.org/inf

Nov 21, 2021
Package zaperations provides a Google Cloud operations suite (formerly Stackdriver) compatible config for the uber-go/zap logger.

Package zaperations provides a Google Cloud Operations (formerly Stackdriver) compatible config for the excellent uber-go/zap logger. Example This exa

Nov 6, 2021
A golang implementation of the Open Pixel Control protocol

__ ___ ___ _____ ___ /'_ `\ / __`\ _______ / __`\/\ '__`\ /'___\ /\ \L\ \/\ \L\ \/\______\/\ \L\ \ \ \L\ \/\ \__/ \ \

Jul 3, 2022
A Statsd implementation written in GO lang

statsgod Statsgod is a metric aggregation service inspired by the statsd project. Written in Golang, it increases performance and can be deployed with

Oct 1, 2022
Log-server - Implement log server for gwaylib/log/adapter/rmsq

Implement server of github.com/gwaylib/log Base on https://github.com/gwaycc/lserver Build . env.sh cd cmd/web go build Deploy Install supd(Debian sy

Jan 3, 2022
The open telemetry framework
The open telemetry framework

DISCONTINUATION OF PROJECT This project will no longer be maintained by Intel. Intel will not provide or guarantee development of or support for this

Dec 27, 2022
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.

The open-source platform for monitoring and observability. Grafana allows you to query, visualize, alert on and understand your metrics no matter wher

Jan 3, 2023
Go implementation of systemd Journal's native API for logging

journald Package journald offers Go implementation of systemd Journal's native API for logging. Key features are: based on a connection-less socket wo

Dec 23, 2022
A reference implementation of blockchain in Go to demonstrate how blockchain works. For education purpose.
A reference implementation of blockchain in Go to demonstrate how blockchain works. For education purpose.

Mini-Blockchain Mini-Blockchain is a reference design for a blockchain system to demostate a full end2end flow in current blockchain technology. There

Nov 18, 2022
A logr LogSink implementation using Zerolog

Zerologr A logr LogSink implementation using Zerolog. Usage import ( "os" "github.com/go-logr/logr" "github.com/hn8/zerologr" "github

Nov 17, 2022
An implementation of A* in Golang

General This is an implementation of the a star path finding algoritm written in Golang. State This software is in pre-alpha state. Development starte

Jan 7, 2022
A logr LogSink implementation using bytes.Buffer

buflogr A logr LogSink implementation using bytes.Buffer. Usage import ( "bytes" "fmt" "github.com/go-logr/logr" "github.com/tonglil/buflogr" )

Jan 6, 2023
Gale-Shapley algoritm implementation in Go

Stable matching Gale-Shapley algoritm implementation in Go. Inspired by Numberphile video. See the explanation on Wikipedia Inputs N×N table of propos

Feb 12, 2022
The full power of the Go Compiler directly in your browser, including a virtual file system implementation. Deployable as a static website.
The full power of the Go Compiler directly in your browser, including a virtual file system implementation. Deployable as a static website.

Static Go Playground Features Full Go Compiler running on the browser. Supports using custom build tags. Incremental builds (build cache). Supports mu

Jun 16, 2022