All Projects → raz-varren → Sacrificial Socket

raz-varren / Sacrificial Socket

Licence: mit
A Go websocket library with an API similar to Socket.IO... but not Socket.IO

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Sacrificial Socket

Sockethub
A protocol gateway for the Web.
Stars: ✭ 329 (+242.71%)
Mutual labels:  redis, websockets, socket-io
Nodebb
Node.js based forum software built for the modern web
Stars: ✭ 12,303 (+12715.63%)
Mutual labels:  redis, websockets, socket-io
Bigq
Messaging platform in C# for TCP and Websockets, with or without SSL
Stars: ✭ 18 (-81.25%)
Mutual labels:  broadcast, websockets
Express Security
nodejs + express security and performance boilerplate.
Stars: ✭ 37 (-61.46%)
Mutual labels:  redis, socket-io
Kuzzle
Open-source Back-end, self-hostable & ready to use - Real-time, storage, advanced search - Web, Apps, Mobile, IoT -
Stars: ✭ 991 (+932.29%)
Mutual labels:  redis, websockets
Jboot
一个优雅的微服务框架,SpringCloud 之外的另一个选择,已经使用在用户量过亿的商业产品上,有超过1000家公司在使用Jboot做极速开发...
Stars: ✭ 655 (+582.29%)
Mutual labels:  grpc, redis
Oneblog
👽 OneBlog,一个简洁美观、功能强大并且自适应的Java博客
Stars: ✭ 678 (+606.25%)
Mutual labels:  redis, websockets
Trycode
Open-source realtime collaborative code editor on Babel, NodeJS, AngularJS, Socket.io, ACE - http://trycode.pw
Stars: ✭ 38 (-60.42%)
Mutual labels:  websockets, socket-io
Vue Socket.io Extended
✌️⚡️ Socket.io bindings for Vue.js and Vuex (inspired by Vue-Socket.io)
Stars: ✭ 506 (+427.08%)
Mutual labels:  websockets, socket-io
Channelstream
Channelstream is a websocket communication server for web applications
Stars: ✭ 52 (-45.83%)
Mutual labels:  broadcast, websockets
Django Channels React Multiplayer
turn based strategy game using django channels, redux, and react hooks
Stars: ✭ 52 (-45.83%)
Mutual labels:  redis, websockets
Thingsboard
Open-source IoT Platform - Device management, data collection, processing and visualization.
Stars: ✭ 10,526 (+10864.58%)
Mutual labels:  grpc, websockets
Centrifugo
Scalable real-time messaging server in a language-agnostic way. Set up once and forever.
Stars: ✭ 5,649 (+5784.38%)
Mutual labels:  redis, grpc
Multi V2ray
v2ray/xray多用户管理部署程序
Stars: ✭ 5,382 (+5506.25%)
Mutual labels:  websockets, grpc
Laravel Event Broadcast
Laravel event broadcasting with Node.js, Redis & Socket.io
Stars: ✭ 5 (-94.79%)
Mutual labels:  redis, socket-io
Swell
Swell: API development tool that enables developers to test endpoints served over streaming technologies including Server-Sent Events (SSE), WebSockets, HTTP2, GraphQL, and gRPC.
Stars: ✭ 517 (+438.54%)
Mutual labels:  grpc, websockets
Socket Io
基于Hyperf微服务协程框架开发的sokcet-io分布式系统
Stars: ✭ 38 (-60.42%)
Mutual labels:  redis, socket-io
Socket.io Python Emitter
Python implementation of socket.io-emitter
Stars: ✭ 67 (-30.21%)
Mutual labels:  redis, socket-io
Wssip
Application for capturing, modifying and sending custom WebSocket data from client to server and vice versa.
Stars: ✭ 373 (+288.54%)
Mutual labels:  websockets, socket-io
Spring boot
Spring Boot 使用总结 和 demo。 如果您觉得本代码对您有所帮助,请点击页面右上方"Star"
Stars: ✭ 431 (+348.96%)
Mutual labels:  grpc, redis

Sacrificial-Socket GoDoc

A Go server library and pure JS client library for managing communication between websockets, that has an API similar to Socket.IO, but feels less... well, Javascripty. Socket.IO is great, but nowadays all modern browsers support websockets natively, so in most cases there is no need to have websocket simulation fallbacks like XHR long polling or Flash. Removing these allows Sacrificial-Socket to be lightweight and very performant.

Sacrificial-Socket supports rooms, roomcasts, broadcasts, and event emitting just like Socket.IO, but with one key difference. The data passed into event functions is not an interface{} that is implied to be a string or map[string]interface{}, but is always passed in as a []byte making it easier to unmarshal into your own JSON data structs, convert to a string, or keep as binary data without the need to check the data's type before processing it. It also means there aren't any unnecessary conversions to the data between the client and the server.

Sacrificial-Socket also has a MultihomeBackend interface for syncronizing broadcasts and roomcasts across multiple instances of Sacrificial-Socket running on multiple machines. Out of the box Sacrificial-Socket provides a MultihomeBackend interface for the popular noSQL database MongoDB, one for the moderately popular key/value storage engine Redis, and one for the not so popular GRPC protocol, for syncronizing instances on multiple machines.

In depth examples can be found in the examples directory.

Usage

Client Javascript:

(function(SS){ 'use strict';
    var ss = new SS('ws://localhost:8080/socket');
    ss.onConnect(function(){
        ss.emit('echo', 'hello echo!');
    });
    
    ss.on('echo', function(data){
        alert('got echo:', data);
        ss.close();
    });
    
    ss.onDisconnect(function(){
        console.log('socket connection closed');
    });
})(window.SS);

Server Go:

package main

import(
    "net/http"
    ss "github.com/raz-varren/sacrificial-socket"
)

func doEcho(s *ss.Socket, data []byte) {
    s.Emit("echo", string(data))
}

func main() {
    s := ss.NewServer()
    s.On("echo", doEcho)
    
    http.Handle("/socket", s)
    http.ListenAndServe(":8080", nil);
}
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].