Git Product home page Git Product logo

golem's Introduction

golem v0.4.4

A lightweight extendable Go WebSocket-framework with client library.

License

Golem is available under the Apache License, Version 2.0

Installation

go get github.com/trevex/golem

Client

A client is also available and heavily used in the examples. More information on how the client is used can be found in the client repository.

Simple Example

Server:

type Hello struct {
	From string `json:"from"`
}
type Answer struct {
	Msg string `json:"msg"`
}
func hello(conn *golem.Connection, data *Hello) {
	conn.Emit("answer", &Answer{"Thanks, "+ data.From + "!"})
}
func main() {
	myrouter := golem.NewRouter()
	myrouter.On("hello", hello)
	http.HandleFunc("/ws", myrouter.Handler())
	http.ListenAndServe(":8080", nil)
}

Client:

var conn = new golem.Connection("ws://127.0.0.1:8080/ws", true);
conn.on("answer", function(data) {
    console.log("Answer: "+data.msg);
});
conn.on("open", function() {
    conn.emit("hello", { from: "Client" });
});

Output in client console would be Thanks, Client!.

Documentation

The documentation is provided via godoc.

Wiki & Tutorials

More informations and insights can be found on the wiki page along with a tutorial series to learn how to use golem:

More Examples

Several examples are available in the example repository. To use them simply checkout the repository and make sure you installed (go get) golem before. A more detailed guide on how to use them is located in their repository.

History

  • v0.1.0
    • Basic API layout and documentation
  • v0.2.0
    • Evented communication system and routing
    • Basic room implementation (lobbies renamed to rooms for clarity)
  • v0.3.0
    • Protocol extensions through Parsers
    • Room manager for collections of rooms
  • v0.4.0
    • Protocol interchangable
    • Several bugfixes
    • Client up-to-date
  • v0.4.2
    • Connection type can be extended
    • Close added to connection
  • v0.4.3
    • RoomManager emiting create- and remove-events (remove if room has insufficient users)
  • v0.4.4
    • RoomManager manages set of connection dependent options, see example_chat_options.go
    • Router provides OnConnect callback

Special thanks

  • Gary Burd (for the great WebSocket protocol implementation and insights through his examples)
  • Andrew Gallant (for help on golang-nuts mailing list)
  • Kortschak (for help on golang-nuts mailing list)

Contributors

TODO

  • Verbose and configurable logging
  • Testing

golem's People

Contributors

trevex avatar garyburd avatar jefferai avatar

Watchers

James Cloos avatar Matt Sousley 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.