项目作者: jcelliott

项目描述 :
Go implementation of a WAMP (Web Application Messaging Protocol) client and router
高级语言: Go
项目地址: git://github.com/jcelliott/turnpike.git
创建时间: 2013-04-20T02:08:02Z
项目社区:https://github.com/jcelliott/turnpike

开源协议:MIT License

下载


Turnpike Build Status Coverage Status GoDoc

Go implementation of WAMP - The Web Application Messaging Protocol

WAMP (“The Web Application Messaging Protocol”) is a communication protocol
that enables distributed application architectures, with application
functionality spread across nodes and all application communication decoupled
by messages routed via dedicated WAMP routers.

At its core, WAMP provides applications with two asynchronous messaging
patterns within one unified protocol:

  • Publish & Subscribe
  • Remote Procedure Calls

This package provides router and client library implementations as well as a
basic stand-alone router. The router library can be used to embed a WAMP router
in another application, or to build a custom router implementation. The client
library can be used to communicate with any WAMP router.

This version of Turnpike supports WAMP v2. For WAMP v1 support see the v1 branch.

Status

Turnpike v2 is still under development, but is getting close to a stable
release. If you have any feedback or suggestions, please
open an issue.

Installation

Library:

  1. go get -u gopkg.in/jcelliott/turnpike.v2

Stand-alone router:

  1. go get -u gopkg.in/jcelliott/turnpike.v2/turnpike

Client library usage

  1. // TODO

Server library usage

main.go:

  1. package main
  2. import (
  3. "log"
  4. "net/http"
  5. "gopkg.in/jcelliott/turnpike.v2"
  6. )
  7. func main() {
  8. turnpike.Debug()
  9. s := turnpike.NewBasicWebsocketServer("example.realm")
  10. server := &http.Server{
  11. Handler: s,
  12. Addr: ":8000",
  13. }
  14. log.Println("turnpike server starting on port 8000")
  15. log.Fatal(server.ListenAndServe())
  16. }

This creates a simple WAMP router listening for websocket connections on port
8000 with a single realm configured.

You can build it like this:

  1. go build -o router main.go

Which will create an executable in your working directory that can be run like
this:

  1. ./router

Stand-alone router usage

Run the router with default settings:

  1. $GOPATH/bin/turnpike

Router options:

  1. Usage of turnpike:
  2. -port int
  3. port to run on (default 8000)
  4. -realm string
  5. realm name (default "realm1")