oguzbilgic / socketio

Socket.io client api for Go

Home Page:http://godoc.org/github.com/oguzbilgic/socketio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Socket.IO Build Status

Package socketio implements a client for SocketIO protocol in Go language as specified in socket.io-spec

Usage

package main

import (
	"fmt"
	"github.com/oguzbilgic/socketio"
)

func main() {
	// Open a new client connection to the given socket.io server
	// Connect to the given channel on the socket.io server
	socket, err := socketio.DialAndConnect("socketio-server.com:80", "/channel", "key=value")
	if err != nil {
		panic(err)
	}

	for {
		// Receive socketio.Message from the server
		msg, err := socket.Receive()
		if err != nil {
			panic(err)
		}

		fmt.Printf("Type: %v, ID: '%s', Endpoint: '%s', Data: '%s' \n", msg.Type, msg.ID, msg.Endpoint, msg.Data)
	}
}

Documentation

http://godoc.org/github.com/oguzbilgic/socketio

License

The MIT License (MIT)

About

Socket.io client api for Go

http://godoc.org/github.com/oguzbilgic/socketio

License:MIT License


Languages

Language:Go 100.0%