diff --git a/README.MD b/README.MD
index 5f922687..0632a77f 100644
--- a/README.MD
+++ b/README.MD
@@ -1,117 +1,12 @@
-[//]: # ()
+# RonyKIT
-[//]: # ( )
+This repository is holding all the projects related to RonyKIT. The main package which is the heart of
+the RonyKIT framework is [kit](./kit) and the standard modules are in the /std folders.
-[//]: # ()
-
-
-
-
-
-
-
-
-
+| Package | BundleType | Version | Description |
+|----------|------------|---------|--------------------------------------------------------------------------------------------------------------------------------------|
+| KIT | - | v0.8.4 | the main package of the RonyKIT framework |
+| fasthttp | Gateway | v0.8.4 | the Gateway bundle implemented using (fasthttp)[https://github.com/valyala/fasthttp] framework |
+| fastws | Gateway | v0.8.4 | the Gateway bundle implemented using (gnet)[https://github.com/panjf2000/gnet] and (gobwas)[https://github.com/gobwas/ws] frameworks |
-# RonyKit
-RonyKit is a library written in Go (Golang), provides the abstraction layer for creating an API server. By defining separate
-components for each task, you are almost free to develop your API server using RPC (Proto/JSON/...), REST, GraphQL or even with your
-in-house defined protocol. However, some components are implemented in the 'std' which make it easy to use RonyKit out of the box.
-In RonyKIT, I wanted to make it more flexible but still very performant. I will maintain two bundles one based on
-[fasthttp](https://github.com/valyala/fasthttp) and the other provides only rpc over websocket based on two very fast
-libraries [gobwas](https://github.com/gobwas/ws) and [gnet](https://github.com/panjf2000/gnet), however you are not limited to use those,
-and
-can build your own Bundles. To have a better understanding of how it is going to work please check examples folder.
-in [simple-rest-server](examples/simple-rest-server) it shows a very simple hello world app.
-in [mixed-jsonrpc-rest](examples/mixed-jsonrpc-rest) it shows how you can write your services once but use them with multiple formats like
-REST or RPC.
-
-## Contents
-
-- [RonyKIT](#ronykit)
- - [Contents](#contents)
- - [Installation](#installation)
- - [Quick start](#quick-start)
- - [Benchmark](#benchmark)
- - [Define Services and Contracts](#define-services-and-contracts)
-
-## Installation
-
-To install RonyKIT package, you need to install Go and set your Go workspace first.
-
-First need to install[Go](https://golang.org/) (**version 1.17+ is required**), then you can use the below Go command to install
-RonyKIT.
-
-```sh
-$ go get -u github.com/clubpay/ronykit/...
-```
-
-## Quick start
-
-You can find some sample codes in the [Examples](./examples) folder.
-
-## Define Services and Contracts
-
-In RonyKIT you better to define the description of your services and their contracts using `desc` package,
-and it provides you many helper methods. Although you can create your concrete implementations of kit.Service
-and kit.Contract, but we strongly recommend you to use `desc` package.
-
-### Define Service Descriptor
-
-The following code demonstrates the steps you need to take to register your service.
-
-```go
-package main
-
-import (
- "context"
- "syscall"
-
- "github.com/clubpay/ronykit"
- "github.com/clubpay/ronykit/desc"
- "github.com/clubpay/ronykit/std/gateway/fasthttp"
-)
-
-type EchoRequest struct {
- RandomID int64 `json:"randomId"`
-}
-
-type EchoResponse struct {
- RandomID int64 `json:"randomId"`
-}
-
-var serviceDesc = desc.NewService("yourServiceUniqueName").
- AddContract(
- desc.NewContract().
- // Add the selector which this contract will be selected based of. Every bundle have its own selector
- // and here we use our std/fasthttp package.
- AddSelector(fasthttp.GET("/echo/:randomId")).
- // Define the input message, it defines the message your handler expects to receive.
- SetInput(&EchoRequest{}).
- // Define the output message, it defines the message your handler expects to return.
- SetOutput(&EchoResponse{}).
- // Set the handler which is going to handle this request.
- SetHandler(echoHandler),
- )
-
-func echoHandler(ctx *kit.Context) {
- req, _ := ctx.In().GetMsg().(*EchoRequest)
- ctx.Out().SetMsg(
- &EchoResponse{
- RandomID: req.RandomID,
- },
- ).Send()
-}
-func main() {
- app := kit.NewServer(
- desc.Register(serviceDesc),
- )
-
- // Start the server
- app.Start(context.Background())
-
- // Wait for signal to shut down
- app.Shutdown(context.Background(), syscall.SIGHUP)
-}
-```
diff --git a/example/go.mod b/example/go.mod
index 63034712..3bcac79f 100644
--- a/example/go.mod
+++ b/example/go.mod
@@ -1,3 +1,33 @@
module github.com/clubpay/ronykit/example
go 1.19
+
+require (
+ github.com/clubpay/ronykit/kit v0.8.3
+ github.com/clubpay/ronykit/std/gateways/fasthttp v0.8.3
+ github.com/clubpay/ronykit/std/gateways/fastws v0.8.3
+ github.com/goccy/go-json v0.9.11
+)
+
+require (
+ github.com/andybalholm/brotli v1.0.4 // indirect
+ github.com/clubpay/ronykit v0.7.3 // indirect
+ github.com/fasthttp/websocket v1.5.1-rc.7 // indirect
+ github.com/gobwas/httphead v0.1.0 // indirect
+ github.com/gobwas/pool v0.2.1 // indirect
+ github.com/gobwas/ws v1.1.0 // indirect
+ github.com/goccy/go-reflect v1.2.0 // indirect
+ github.com/jedib0t/go-pretty/v6 v6.4.0 // indirect
+ github.com/klauspost/compress v1.15.12 // indirect
+ github.com/mattn/go-runewidth v0.0.14 // indirect
+ github.com/panjf2000/gnet/v2 v2.1.2 // indirect
+ github.com/rivo/uniseg v0.4.2 // indirect
+ github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d // indirect
+ github.com/valyala/bytebufferpool v1.0.0 // indirect
+ github.com/valyala/fasthttp v1.41.0 // indirect
+ go.uber.org/atomic v1.10.0 // indirect
+ go.uber.org/multierr v1.8.0 // indirect
+ go.uber.org/zap v1.23.0 // indirect
+ golang.org/x/sys v0.1.0 // indirect
+ gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
+)
diff --git a/example/go.sum b/example/go.sum
new file mode 100644
index 00000000..a8079e4e
--- /dev/null
+++ b/example/go.sum
@@ -0,0 +1,137 @@
+github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=
+github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
+github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
+github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
+github.com/clubpay/ronykit v0.7.3 h1:Q8H/VVOoHvPyg0aEC61Pt6SKHjYELhnD7uyioHe0/s8=
+github.com/clubpay/ronykit v0.7.3/go.mod h1:tkwJK3UtgFpf688cQlE+gypnrI1CDA1bOAqyrNNHoxk=
+github.com/clubpay/ronykit/kit v0.8.3 h1:aXzj3ggpY0kUmPwa3RNnqn46YMCPsz3SE4rKHLTihJ8=
+github.com/clubpay/ronykit/kit v0.8.3/go.mod h1:Eckt1fQrAdEF6mrSMBtQ014Z7ppYQD6WgFMbUGP+CqM=
+github.com/clubpay/ronykit/std/gateways/fasthttp v0.8.3 h1:+ZIzK6yIf4n5IF8Xf3Po9uMxzRPcl07I4/yB9B3kXEY=
+github.com/clubpay/ronykit/std/gateways/fasthttp v0.8.3/go.mod h1:8IiIwizx/YINne4iPlrdMSylmqgc0TAV72aTDn44E0M=
+github.com/clubpay/ronykit/std/gateways/fastws v0.8.3 h1:B0+PRYXNnrf8JH6sGw71BrVP2x0d8I6dtTeO97r7rD8=
+github.com/clubpay/ronykit/std/gateways/fastws v0.8.3/go.mod h1:UaDcNqcK4CyCHmilY9f/ekG6hjGyyzYpHKod9yqLdO0=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/fasthttp/websocket v1.5.1-rc.7 h1:bZCIf4wtGqFTuPYA35srh1BeoSNwmNuIk6jQ7ehGflM=
+github.com/fasthttp/websocket v1.5.1-rc.7/go.mod h1:kaEACzAdRuTbpkRv97v40fICrwwxRioZGEBhGqxbWm0=
+github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU=
+github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
+github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og=
+github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
+github.com/gobwas/ws v1.1.0 h1:7RFti/xnNkMJnrK7D1yQ/iCIB5OrrY/54/H930kIbHA=
+github.com/gobwas/ws v1.1.0/go.mod h1:nzvNcVha5eUziGrbxFCo6qFIojQHjJV5cLYIbezhfL0=
+github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk=
+github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
+github.com/goccy/go-reflect v1.2.0 h1:O0T8rZCuNmGXewnATuKYnkL0xm6o8UNOJZd/gOkb9ms=
+github.com/goccy/go-reflect v1.2.0/go.mod h1:n0oYZn8VcV2CkWTxi8B9QjkCoq6GTtCEdfmR66YhFtE=
+github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
+github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/jedib0t/go-pretty/v6 v6.4.0 h1:YlI/2zYDrweA4MThiYMKtGRfT+2qZOO65ulej8GTcVI=
+github.com/jedib0t/go-pretty/v6 v6.4.0/go.mod h1:MgmISkTWDSFu0xOqiZ0mKNntMQ2mDgOcwOkwBEkMDJI=
+github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
+github.com/klauspost/compress v1.15.12 h1:YClS/PImqYbn+UILDnqxQCZ3RehC9N318SU3kElDUEM=
+github.com/klauspost/compress v1.15.12/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
+github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
+github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
+github.com/onsi/ginkgo/v2 v2.2.0 h1:3ZNA3L1c5FYDFTTxbFeVGGD8jYvjYauHD30YgLxVsNI=
+github.com/onsi/gomega v1.21.1 h1:OB/euWYIExnPBohllTicTHmGTrMaqJ67nIu80j0/uEM=
+github.com/panjf2000/ants/v2 v2.4.8 h1:JgTbolX6K6RreZ4+bfctI0Ifs+3mrE5BIHudQxUDQ9k=
+github.com/panjf2000/ants/v2 v2.4.8/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A=
+github.com/panjf2000/gnet/v2 v2.1.2 h1:WJ/PkbfV6G0wcGOng2pyCwv8oadKiqtP8p+38smN7ao=
+github.com/panjf2000/gnet/v2 v2.1.2/go.mod h1:unWr2B4jF0DQPJH3GsXBGQiDcAamM6+Pf5FiK705kc4=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
+github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
+github.com/rivo/uniseg v0.4.2 h1:YwD0ulJSJytLpiaWua0sBDusfsCZohxjxzVTYjwxfV8=
+github.com/rivo/uniseg v0.4.2/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
+github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d h1:Q+gqLBOPkFGHyCJxXMRqtUgUbTjI8/Ze8vu8GGyNFwo=
+github.com/savsgio/gotils v0.0.0-20220530130905-52f3993e8d6d/go.mod h1:Gy+0tqhJvgGlqnTF8CVGP0AaGRjwBtXs/a5PA0Y3+A4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/stretchr/testify v1.7.4/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
+github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
+github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
+github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
+github.com/valyala/fasthttp v1.41.0 h1:zeR0Z1my1wDHTRiamBCXVglQdbUwgb9uWG3k1HQz6jY=
+github.com/valyala/fasthttp v1.41.0/go.mod h1:f6VbjjoI3z1NDOZOv17o6RvtRSWxC77seBFc2uWtgiY=
+github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
+github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
+go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
+go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
+go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
+go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
+go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
+go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
+go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
+go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
+go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
+go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
+go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
+go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY=
+go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
+golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20220906165146-f3363e06e74c h1:yKufUcDwucU5urd+50/Opbt4AYpqthk7wHpHok8f1lo=
+golang.org/x/net v0.0.0-20220906165146-f3363e06e74c/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
+golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
+gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/example/simple-rest-server/api/service.go b/example/simple-rest-server/api/service.go
index deba5ee6..cd071569 100644
--- a/example/simple-rest-server/api/service.go
+++ b/example/simple-rest-server/api/service.go
@@ -4,9 +4,10 @@ import (
"fmt"
"net/http"
- "github.com/clubpay/ronykit/desc"
"github.com/clubpay/ronykit/example/simple-rest-server/dto"
- "github.com/clubpay/ronykit/std/gateway/fasthttp"
+ "github.com/clubpay/ronykit/kit"
+ "github.com/clubpay/ronykit/kit/desc"
+ "github.com/clubpay/ronykit/std/gateways/fasthttp"
)
var SampleDesc desc.ServiceDescFunc = func() *desc.Service {
diff --git a/kit/README.MD b/kit/README.MD
new file mode 100644
index 00000000..fdf48cde
--- /dev/null
+++ b/kit/README.MD
@@ -0,0 +1,117 @@
+[//]: # ()
+
+[//]: # ( )
+
+[//]: # ()
+
+
+
+
+
+
+
+
+
+
+# RonyKit
+
+RonyKit is a library written in Go (Golang), provides the abstraction layer for creating an API server. By defining separate
+components for each task, you are almost free to develop your API server using RPC (Proto/JSON/...), REST, GraphQL or even with your
+in-house defined protocol. However, some components are implemented in the 'std' which make it easy to use RonyKit out of the box.
+In RonyKIT, I wanted to make it more flexible but still very performant. I will maintain two bundles one based on
+[fasthttp](https://github.com/valyala/fasthttp) and the other provides only rpc over websocket based on two very fast
+libraries [gobwas](https://github.com/gobwas/ws) and [gnet](https://github.com/panjf2000/gnet), however you are not limited to use those,
+and
+can build your own Bundles. To have a better understanding of how it is going to work please check examples folder.
+in [simple-rest-server](examples/simple-rest-server) it shows a very simple hello world app.
+in [mixed-jsonrpc-rest](examples/mixed-jsonrpc-rest) it shows how you can write your services once but use them with multiple formats like
+REST or RPC.
+
+## Contents
+
+- [RonyKIT](#ronykit)
+ - [Contents](#contents)
+ - [Installation](#installation)
+ - [Quick start](#quick-start)
+ - [Benchmark](#benchmark)
+ - [Define Services and Contracts](#define-services-and-contracts)
+
+## Installation
+
+To install RonyKIT package, you need to install Go and set your Go workspace first.
+
+First need to install[Go](https://golang.org/) (**version 1.17+ is required**), then you can use the below Go command to install
+RonyKIT.
+
+```sh
+$ go get -u github.com/clubpay/ronykit/...
+```
+
+## Quick start
+
+You can find some sample codes in the [Examples](./examples) folder.
+
+## Define Services and Contracts
+
+In RonyKIT you better to define the description of your services and their contracts using `desc` package,
+and it provides you many helper methods. Although you can create your concrete implementations of kit.Service
+and kit.Contract, but we strongly recommend you to use `desc` package.
+
+### Define Service Descriptor
+
+The following code demonstrates the steps you need to take to register your service.
+
+```go
+package main
+
+import (
+ "context"
+ "syscall"
+
+ "github.com/clubpay/ronykit/kit"
+ "github.com/clubpay/ronykit/kit/desc"
+ "github.com/clubpay/ronykit/std/gateways/fasthttp"
+)
+
+type EchoRequest struct {
+ RandomID int64 `json:"randomId"`
+}
+
+type EchoResponse struct {
+ RandomID int64 `json:"randomId"`
+}
+
+var serviceDesc = desc.NewService("yourServiceUniqueName").
+ AddContract(
+ desc.NewContract().
+ // Add the selector which this contract will be selected based of. Every bundle have its own selector
+ // and here we use our std/fasthttp package.
+ AddSelector(fasthttp.GET("/echo/:randomId")).
+ // Define the input message, it defines the message your handler expects to receive.
+ SetInput(&EchoRequest{}).
+ // Define the output message, it defines the message your handler expects to return.
+ SetOutput(&EchoResponse{}).
+ // Set the handler which is going to handle this request.
+ SetHandler(echoHandler),
+ )
+
+func echoHandler(ctx *kit.Context) {
+ req, _ := ctx.In().GetMsg().(*EchoRequest)
+ ctx.Out().SetMsg(
+ &EchoResponse{
+ RandomID: req.RandomID,
+ },
+ ).Send()
+}
+func main() {
+ app := kit.NewServer(
+ desc.Register(serviceDesc),
+ )
+
+ // Start the server
+ app.Start(context.Background())
+
+ // Wait for signal to shut down
+ app.Shutdown(context.Background(), syscall.SIGHUP)
+}
+```
diff --git a/std/gateways/fastws/gateway.go b/std/gateways/fastws/gateway.go
index f896423f..99f11d9b 100644
--- a/std/gateways/fastws/gateway.go
+++ b/std/gateways/fastws/gateway.go
@@ -10,6 +10,7 @@ import (
"time"
"github.com/clubpay/ronykit/kit"
+ "github.com/clubpay/ronykit/kit/errors"
"github.com/clubpay/ronykit/utils"
"github.com/clubpay/ronykit/utils/buf"
"github.com/gobwas/ws"