All Projects → go-netty → Go Netty

go-netty / Go Netty

Licence: apache-2.0
Extensible network application framework inspired by netty

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Go Netty

Nettyrpc
A simple RPC framework based on Netty, ZooKeeper and Spring
Stars: ✭ 1,975 (+1035.06%)
Mutual labels:  netty
Agentx
Shadowsocks升级版,支持协议伪装和流量压缩,易于扩展,可统计流量
Stars: ✭ 154 (-11.49%)
Mutual labels:  netty
Netty 4 User Guide
Chinese translation of Netty 4.x User Guide. 中文翻译《Netty 4.x 用户指南》
Stars: ✭ 2,061 (+1084.48%)
Mutual labels:  netty
Carmelo
Carmelo is a fast, scalable Java server framework designed for online games. It uses Netty and Fastjson for highly efficient network transmission and supports both TCP/HTTP protocols.
Stars: ✭ 148 (-14.94%)
Mutual labels:  netty
Okra
High performance game server framework by netty and disruptor
Stars: ✭ 152 (-12.64%)
Mutual labels:  netty
Nasus
Zero-configuration command-line async HTTP files server in Clojure. Like Python's SimpleHTTPServer but scalable.
Stars: ✭ 158 (-9.2%)
Mutual labels:  netty
Him Vue
开源的H5即时聊天系统 spring-boot + netty + protobuf + vue ~
Stars: ✭ 142 (-18.39%)
Mutual labels:  netty
Mqttnet
MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
Stars: ✭ 2,486 (+1328.74%)
Mutual labels:  net
Nettychat
基于Netty+TCP+Protobuf实现的Android IM库,包含Protobuf序列化、TCP拆包与粘包、长连接握手认证、心跳机制、断线重连机制、消息重发机制、读写超时机制、离线消息、线程池等功能。
Stars: ✭ 1,979 (+1037.36%)
Mutual labels:  netty
Acl
Server framework and network components written by C/C++ for Linux, Mac, FreeBSD, Solaris(x86), Windows, Android, IOS
Stars: ✭ 2,113 (+1114.37%)
Mutual labels:  net
Netty Learning Example
🥚 Netty实践学习案例,见微知著!带着你的心,跟着教程。我相信你行欧。
Stars: ✭ 2,146 (+1133.33%)
Mutual labels:  netty
Dotnettyrpc
A RPC Framework Based On DotNetty
Stars: ✭ 153 (-12.07%)
Mutual labels:  net
Esl Client
A Fork from http://git.freeswitch.org/git/freeswitch-contrib/tree/dvarnes/java/esl-client
Stars: ✭ 160 (-8.05%)
Mutual labels:  netty
Wechat
仿QQ即时通讯系统客户端
Stars: ✭ 144 (-17.24%)
Mutual labels:  netty
Sofa Bolt
SOFABolt is a lightweight, easy to use and high performance remoting framework based on Netty.
Stars: ✭ 2,057 (+1082.18%)
Mutual labels:  netty
Clickhouse Net
Yandex ClickHouse fully managed .NET client
Stars: ✭ 142 (-18.39%)
Mutual labels:  net
Vert.x
Vert.x is a tool-kit for building reactive applications on the JVM
Stars: ✭ 12,544 (+7109.2%)
Mutual labels:  netty
Source Code Hunter
😱 从源码层面,剖析挖掘互联网行业主流技术的底层实现原理,为广大开发者 “提升技术深度” 提供便利。目前开放 Spring 全家桶,Mybatis、Netty、Dubbo 框架,及 Redis、Tomcat 中间件等
Stars: ✭ 7,392 (+4148.28%)
Mutual labels:  netty
Code4java
Repository for my java projects.
Stars: ✭ 164 (-5.75%)
Mutual labels:  netty
Rsocket Java
Java implementation of RSocket
Stars: ✭ 2,099 (+1106.32%)
Mutual labels:  netty

GO-NETTY

GoDoc license-Apache 2 Go Report Card Build Status Coverage Status

中文介绍

Introduction

go-netty is heavily inspired by netty

Feature

  • Extensible transport support, default support TCP, UDP, QUIC, KCP, Websocket
  • Extensible codec support
  • Based on responsibility chain model
  • Zero-dependency

Documentation

Examples

Quick Start

package main

import (
	"fmt"
	"os"
	"strings"

	"github.com/go-netty/go-netty"
	"github.com/go-netty/go-netty/codec/format"
	"github.com/go-netty/go-netty/codec/frame"
	"github.com/go-netty/go-netty/transport/tcp"
)

func main() {

    // child pipeline initializer
    var childPipelineInitializer = func(channel netty.Channel) {
        channel.Pipeline().
            // the maximum allowable packet length is 128 bytes,use \n to splite, strip delimiter
            AddLast(frame.DelimiterCodec(128, "\n", true)).
            // convert to string
            AddLast(format.TextCodec()).
            // LoggerHandler, print connected/disconnected event and received messages
            AddLast(LoggerHandler{}).
            // UpperHandler (string to upper case)
            AddLast(UpperHandler{})
    }

    // new go-netty bootstrap
    netty.NewBootstrap().
        // configure the child pipeline initializer
        ChildInitializer(childPipelineInitializer).
        // configure the transport protocol
        Transport(tcp.New()).
        // configure the listening address
        Listen("0.0.0.0:9527").
        // waiting for exit signal
        Action(netty.WaitSignal(os.Interrupt)).
        // print exit message
        Action(func(bs netty.Bootstrap) {
            fmt.Println("server exited")
        })
}

type LoggerHandler struct {}

func (LoggerHandler) HandleActive(ctx netty.ActiveContext) {
    fmt.Println("go-netty:", "->", "active:", ctx.Channel().RemoteAddr())
    // write welcome message
    ctx.Write("Hello I'm " + "go-netty")
}

func (LoggerHandler) HandleRead(ctx netty.InboundContext, message netty.Message) {
    fmt.Println("go-netty:", "->", "handle read:", message)
    // leave it to the next handler(UpperHandler)
    ctx.HandleRead(message)
}

func (LoggerHandler) HandleInactive(ctx netty.InactiveContext, ex netty.Exception) {
    fmt.Println("go-netty:", "->", "inactive:", ctx.Channel().RemoteAddr(), ex)
    // disconnected,the default processing is to close the connection
    ctx.HandleInactive(ex)
}

type UpperHandler struct {}

func (UpperHandler) HandleRead(ctx netty.InboundContext, message netty.Message) {
    // text to upper case
    text := message.(string)
    upText := strings.ToUpper(text)
    // write the result to the client
    ctx.Write(text + " -> " + upText)
}

using Netcat to send message

$ echo -n -e "Hello Go-Netty\nhttps://go-netty.com\n" | nc 127.0.0.1 9527
Hello I'm go-netty
Hello Go-Netty -> HELLO GO-NETTY
https://go-netty.com -> HTTPS://GO-NETTY.COM
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].