GithubHelp home page GithubHelp logo

gitwangjiahui / gosmpp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from linxgnu/gosmpp

0.0 0.0 0.0 3.75 MB

Smpp (3.4) Client Library for Go

License: Apache License 2.0

C++ 19.53% Go 80.47%

gosmpp's Introduction

gosmpp

Go Report Card Coverage Status godoc

SMPP (3.4) Client Library in pure Go.

This library is well tested with SMSC simulators:

Installation

go get -u github.com/linxGnu/gosmpp

Usage

Highlight

  • From v0.1.4, gosmpp is written in event-based style and fully-manage your smpp session, connection, error, rebinding, etc. You only need to implement some hooks:
		trans, err := gosmpp.NewSession(
		gosmpp.TRXConnector(gosmpp.NonTLSDialer, auth),
		gosmpp.Settings{
			EnquireLink: 5 * time.Second,

			ReadTimeout: 10 * time.Second,

			OnSubmitError: func(_ pdu.PDU, err error) {
				log.Fatal("SubmitPDU error:", err)
			},

			OnReceivingError: func(err error) {
				fmt.Println("Receiving PDU/Network error:", err)
			},

			OnRebindingError: func(err error) {
				fmt.Println("Rebinding but error:", err)
			},

			OnPDU: handlePDU(),

			OnClosed: func(state gosmpp.State) {
				fmt.Println(state)
			},
		}, 5*time.Second)
		if err != nil {
		  log.Println(err)
		}
		defer func() {
		  _ = trans.Close()
		}()

Version (0.1.4.RC+)

Old version (0.1.3 and previous)

Full example could be found: gist

Supported PDUs

  • bind_transmitter
  • bind_transmitter_resp
  • bind_receiver
  • bind_receiver_resp
  • bind_transceiver
  • bind_transceiver_resp
  • outbind
  • unbind
  • unbind_resp
  • submit_sm
  • submit_sm_resp
  • submit_sm_multi
  • submit_sm_multi_resp
  • data_sm
  • data_sm_resp
  • deliver_sm
  • deliver_sm_resp
  • query_sm
  • query_sm_resp
  • cancel_sm
  • cancel_sm_resp
  • replace_sm
  • replace_sm_resp
  • enquire_link
  • enquire_link_resp
  • alert_notification
  • generic_nack

gosmpp's People

Contributors

linxgnu avatar bachhh avatar septs avatar goten4 avatar linhduonggnu avatar linhtran1989 avatar dependabot[bot] avatar dasmfm avatar laduchesneau avatar

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.