Skip to content

Commit

Permalink
Updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Hahn committed Mar 23, 2018
1 parent e2d2a88 commit 6de118b
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 443 deletions.
30 changes: 3 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ mobile games, etc of all sizes.

#### What does a `pitaya` application look like?

The simplest "pitaya" application as shown in the following figure, you can make powerful applications by combining different components.

![Application](./application.png)

In fact, the `pitaya` application is a collection of  [Component ](./docs/get_started.md#component) , and a component is a bundle of  [Handler](./docs/get_started.md#handler), once you register a component to pitaya, pitaya will register all methods that can be converted to `Handler` to pitaya service container. Service was accessed by `Component.Handler`, and the handler will be called while client request. The handler will receive two parameters while handling a message:
In fact, the `pitaya` application is a collection of  [Component ](./docs/get_started.md#component) , and a component is a bundle of  [Handler](./docs/get_started.md#handler), once you register a component to pitaya, pitaya will register all methods that can be converted to `Handler` to pitaya service container. Service is accessed by `Component.Handler`, and the handler will be called when the client makes a request. The handler receives two parameters while handling a message:
- `*session.Session`: corresponding a client that apply this request or notify.
- `*protocol.FooBar`: the payload of the request.

While you had processed your logic, you can response or push message to the client by `session.Response(payload)` and `session.Push('eventName', payload)`, or returns error when some unexpected data received.
When the server has processed the logic, it can respond or push message to the client by `session.Response(payload)` and `session.Push('eventName', payload)`, or return error if some unexpected error happens.

#### How to build distributed system with `pitaya`

Expand Down Expand Up @@ -79,7 +75,7 @@ func (r *RemoteComponent) client(s *session.Session) *grpc.ClientConn {
}

// Your handler, accessed by:
// nanoClient.Request("RemoteComponent.DemoHandler", &pb.DemoMsg{/*...*/})
// client.Request("RemoteComponent.DemoHandler", &pb.DemoMsg{/*...*/})
func (r *RemoteComponent) DemoHandler(s *session.Session, msg *pb.DemoMsg) error {
client := r.client(s)
// do something with client
Expand All @@ -101,13 +97,6 @@ The pitaya will remain simple, but you can perform any operations in the compone
+ [API Reference(Server)](https://godoc.org/github.com/topfreegames/pitaya)
+ [How to integrate `Lua` into `pitaya` component(incomplete)](.)

- 简体中文
+ [如何构建你的第一个pitaya应用](./docs/get_started_zh_CN.md)
+ [路由压缩](./docs/route_compression_zh_CN.md)
+ [通信协议](./docs/communication_protocol_zh_CN.md)
+ [API参考(服务器)](https://godoc.org/github.com/topfreegames/pitaya)
+ [如何将`lua`脚本集成到`pitaya`组件中(未完成)](.)

## Resources

- Javascript
Expand All @@ -118,14 +107,6 @@ The pitaya will remain simple, but you can perform any operations in the compone
+ [Implement a chat room in 100 lines with pitaya and WebSocket](./examples/demo/chat)
+ [Tadpole demo](./examples/demo/tadpole)

## Community

- QQGroup: [289680347](https://jq.qq.com/?_wv=1027&k=4EMMaha)
- Reddit: [nanolabs](https://www.reddit.com/r/nanolabs/)

## Successful cases

- [空来血战](https://fir.im/tios)

## Installation

Expand All @@ -139,11 +120,6 @@ dep ensure
## Benchmark

```shell
# Case: PingPong
# OS: Windows 10
# Device: i5-6500 3.2GHz 4 Core/1000-Concurrent   => IOPS 11W(Average)
# Other: ...

cd $GOPATH/src/github.com/topfreegames/pitaya/benchmark/io
go test -v -tags "benchmark"
```
Expand Down
Binary file removed application.png
Binary file not shown.
167 changes: 0 additions & 167 deletions docs/communication_protocol_zh_CN.md

This file was deleted.

Loading

0 comments on commit 6de118b

Please sign in to comment.