All Projects → lonng → Starx

lonng / Starx

[DEPRECATED] Lightweight, scalable ,distributed game server framework for Golang

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Starx

keyple-java
Eclipse Keyple™ Project: deprecated repository embedding all components of the Java implementation until version 1.0.0
Stars: ✭ 17 (-94.48%)
Mutual labels:  deprecated
ngx-mat-datetime-picker
⛔️ DEPRECATED This is no longer supported, please consider using the repository @angular-material-components/datetime-picker(https://github.com/h2qutc/angular-material-components) instead.
Stars: ✭ 29 (-90.58%)
Mutual labels:  deprecated
Grunt Filerev
[DEPRECATED] File revving
Stars: ✭ 261 (-15.26%)
Mutual labels:  deprecated
python-poster
DEPRECATED Streaming HTTP uploads and multipart/form-data encoding
Stars: ✭ 16 (-94.81%)
Mutual labels:  deprecated
Liquid-Application-Framework-1.0-deprecated
Liquid is a framework to speed up the development of microservices
Stars: ✭ 26 (-91.56%)
Mutual labels:  deprecated
rust-usb
Deprecated: see libusb-rs
Stars: ✭ 23 (-92.53%)
Mutual labels:  deprecated
jade-babel
Jade plugin for Babel
Stars: ✭ 39 (-87.34%)
Mutual labels:  deprecated
Simpleauthentication
⛔️ [DEPRECATED] A really simple way for developers to add "Social Authentication" to their ASP.NET web application
Stars: ✭ 299 (-2.92%)
Mutual labels:  deprecated
dashboard-extension-parameter-item
⛔ DEPRECATED. This project was moved to a new repository. Visit https://github.com/DevExpress/dashboard-extensions to find an updated version.
Stars: ✭ 47 (-84.74%)
Mutual labels:  deprecated
Bio.jl
[DEPRECATED] Bioinformatics and Computational Biology Infrastructure for Julia
Stars: ✭ 257 (-16.56%)
Mutual labels:  deprecated
aldryn-bootstrap3
DEPRECATED, this project is no longer maintained, see README for more information.
Stars: ✭ 44 (-85.71%)
Mutual labels:  deprecated
matterpoll-emoji
[DEPRECATED] Poll server for Mattermost
Stars: ✭ 38 (-87.66%)
Mutual labels:  deprecated
lumbermill
DEPRECATED: Log Processor. See https://engineering.heroku.com/blogs/2016-05-26-heroku-metrics-there-and-back-again/ for more information.
Stars: ✭ 42 (-86.36%)
Mutual labels:  deprecated
addon-sdk-content-scripts
DEPRECATED | Use WebExtensions instead | Add-ons demonstrating how to use content scripts in the Add-on SDK.
Stars: ✭ 23 (-92.53%)
Mutual labels:  deprecated
Vip Quickstart
Retired
Stars: ✭ 268 (-12.99%)
Mutual labels:  deprecated
broccoli-traceur
Traceur is a JavaScript.next to JavaScript-of-today compiler
Stars: ✭ 29 (-90.58%)
Mutual labels:  deprecated
VRTK.Prefabs
*Deprecated* - A collection of productive prefabs for rapidly building spatial computing solutions in the Unity software.
Stars: ✭ 61 (-80.19%)
Mutual labels:  deprecated
Weka
Now redundant weka mirror. Visit https://github.com/Waikato/weka-trunk for the real deal
Stars: ✭ 304 (-1.3%)
Mutual labels:  deprecated
Prehistoric Entware
Prehistoric Entware
Stars: ✭ 282 (-8.44%)
Mutual labels:  deprecated
tmwa
DEPRECATED: The server running The Mana World Legacy. All new projects should use Hercules instead. See the "evol-hercules" repo.
Stars: ✭ 44 (-85.71%)
Mutual labels:  deprecated

DEPRECATED

Do not use in a production environment, new project ref: https://github.com/lonnng/nano/

Starx -- golang based game server framework

Inspired by Pomelo, rewrite with golang.

Client Library

Chat Room Demo

implement a chat room in 100 lines with golang and websocket starx-chat-demo

  • server

    package main
    
    import (
    	"github.com/lonnng/starx"
    	"github.com/lonnng/starx/component"
    	"github.com/lonnng/starx/serialize/json"
    	"github.com/lonnng/starx/session"
    )
    
    type Room struct {
    	component.Base
    	channel *starx.Channel
    }
    
    type UserMessage struct {
    	Name    string `json:"name"`
    	Content string `json:"content"`
    }
    
    type JoinResponse struct {
    	Code   int    `json:"code"`
    	Result string `json:"result"`
    }
    
    func NewRoom() *Room {
    	return &Room{
    		channel: starx.ChannelService.NewChannel("room"),
    	}
    }
    
    func (r *Room) Join(s *session.Session, msg []byte) error {
    	s.Bind(s.ID)     // binding session uid
    	r.channel.Add(s) // add session to channel
    	return s.Response(JoinResponse{Result: "sucess"})
    }
    
    func (r *Room) Message(s *session.Session, msg *UserMessage) error {
    	return r.channel.Broadcast("onMessage", msg)
    }
    
    func main() {
    	starx.SetAppConfig("configs/app.json")
        starx.SetServersConfig("configs/servers.json")
    	starx.Register(NewRoom())
    
    	starx.SetServerID("demo-server-1")
    	starx.SetSerializer(json.NewJsonSerializer())
    	starx.Run()
    }
    
    
  • client

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Chat Demo</title>
    </head>
    <body>
    <div id="container">
        <ul>
            <li v-for="msg in messages">[<span style="color:red;">{{msg.name}}</span>]{{msg.content}}</li>
        </ul>
        <div class="controls">
            <input type="text" v-model="nickname">
            <input type="text" v-model="inputMessage">
            <input type="button" v-on:click="sendMessage" value="Send">
        </div>
    </div>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.min.js" type="text/javascript"></script>
    <!--[starx websocket library](https://github.com/lonnng/starx-client-websocket)-->
    <script src="protocol.js" type="text/javascript"></script>
    <script src="starx-wsclient.js" type="text/javascript"></script>
    <script>
        var v = new Vue({
            el: "#container",
            data: {
                nickname:'guest' + Date.now(),
                inputMessage:'',
                messages: []
            },
            methods: {
                sendMessage: function () {
                    starx.notify('Room.Message', {name: this.nickname, content: this.inputMessage});
                    this.inputMessage = '';
                }
            }
        });
    
        var onMessage = function (msg) {
            v.messages.push(msg)
        };
    
        var join = function (data) {
            if(data.code == 0) {
                v.messages.push({name:'system', content:data.result});
                starx.on('onMessage', onMessage)
            }
        };
    
        starx.init({host: '127.0.0.1', port: 3250}, function () {
            starx.request("Room.Join", {}, join);
        })
    </script>
    </body>
    </html>
    

Demo

Wiki

Homepage

The MIT License

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].