Skip to content

Commit

Permalink
merge log
Browse files Browse the repository at this point in the history
  • Loading branch information
oikomi committed May 6, 2015
1 parent 79fd35c commit 50a5604
Show file tree
Hide file tree
Showing 38 changed files with 1,543 additions and 247 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ gateway server主要是接受client请求,进行通用的功能设置,目前

### msg_server
msg_server是消息的主体,维护着客户端连接和keeplive,同时要注意router、manager和monitor都订阅了msg_server的channel
<pre><code>
SYSCTRL_CLIENT_STATUS = "/sysctrl/client-status"
<pre><code>SYSCTRL_CLIENT_STATUS = "/sysctrl/client-status"
SYSCTRL_TOPIC_STATUS = "/sysctrl/topic-status"
SYSCTRL_TOPIC_SYNC = "/sysctrl/topic-sync"
SYSCTRL_SEND = "/sysctrl/send"
Expand All @@ -55,14 +54,14 @@ msg_server是消息的主体,维护着客户端连接和keeplive,同时要注
router顾名思义是做了msg_server之间的消息转发

### manager
manager主要是管理client信息存储、离线消息存储等等,通过它和redis联系
manager主要是管理client信息存储、topic信息存储、离线消息存储等等,通过它和redis联系

### monitor
monitor主要是收集监控各服务器状态信息,目前monitor是可选项,可按需要启动它

部署
======
FishChatServer采用分布式可伸缩部署方式。如果没有多机条件,可以单机部署:
FishChatServer采用分布式可伸缩部署方式(各类服务器角色都可以动态增减)。如果没有多机条件,可以单机部署:

建议:
单机测试部署
Expand Down Expand Up @@ -104,7 +103,7 @@ FishChatServer完全采用Golang开发(https://golang.org/)

音视频方案
---------------------
音视频采用nginx-rtmp架构,借助ffmpeg技术,客户端输出rtmp流,服务器输出hls流
音视频采用nginx-rtmp架构,借助ffmpeg技术,客户端推送rtmp流,服务器输出hls流

协议
---------------------
Expand All @@ -126,7 +125,7 @@ FishChatServer完全采用Golang开发(https://golang.org/)
Copyright & License
===================

Copyright 2014 Hong Miao ([email protected]). All Rights Reserved.
Copyright 2014-2015 Hong Miao ([email protected]). All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Binary file modified client/client_p2p/client_p2p
Binary file not shown.
47 changes: 21 additions & 26 deletions client/client_p2p/client_p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"fmt"
"flag"
"encoding/json"
"github.com/golang/glog"
"github.com/oikomi/FishChatServer/log"
"github.com/oikomi/FishChatServer/libnet"
"github.com/oikomi/FishChatServer/protocol"
"github.com/oikomi/FishChatServer/common"
Expand All @@ -41,7 +41,7 @@ func main() {
flag.Parse()
cfg, err := LoadConfig(*InputConfFile)
if err != nil {
glog.Error(err.Error())
log.Error(err.Error())
return
}

Expand All @@ -52,30 +52,30 @@ func main() {
panic(err)
}

//glog.Info("...")
cmd := protocol.NewCmdSimple(protocol.REQ_MSG_SERVER_CMD)

err = gatewayClient.Send(libnet.Json(cmd))
if err != nil {
glog.Error(err.Error())
log.Error(err.Error())
}

fmt.Println("input id :")
fmt.Println("input my id :")
var myID string
var input string
if _, err := fmt.Scanf("%s\n", &input); err != nil {
glog.Error(err.Error())
if _, err := fmt.Scanf("%s\n", &myID); err != nil {
log.Error(err.Error())
}
var c protocol.CmdSimple
err = gatewayClient.ProcessOnce(func(msg *libnet.InBuffer) error {
glog.Info(string(msg.Data))
log.Info(string(msg.Data))
err = json.Unmarshal(msg.Data, &c)
if err != nil {
glog.Error("error:", err)
log.Error("error:", err)
}
return nil
})
if err != nil {
glog.Error(err.Error())
log.Error(err.Error())
}

gatewayClient.Close()
Expand All @@ -89,23 +89,23 @@ func main() {

fmt.Println("send your id...")
cmd = protocol.NewCmdSimple(protocol.SEND_CLIENT_ID_CMD)
cmd.AddArg(input)
cmd.AddArg(myID)

err = msgServerClient.Send(libnet.Json(cmd))
if err != nil {
glog.Error(err.Error())
log.Error(err.Error())
}

go heartBeat(cfg, msgServerClient)

//glog.Info("the msg you want to send...")
//log.Info("the msg you want to send...")


go msgServerClient.Process(func(msg *libnet.InBuffer) error {
//glog.Info(string(msg.Data))
//log.Info(string(msg.Data))
err = json.Unmarshal(msg.Data, &c)
if err != nil {
glog.Error("error:", err)
log.Error("error:", err)
}
fmt.Println(c.GetArgs()[1] + " says : " + c.GetArgs()[0])

Expand All @@ -117,37 +117,32 @@ func main() {

fmt.Println("send the id you want to talk :")
if _, err = fmt.Scanf("%s\n", &input); err != nil {
glog.Error(err.Error())
log.Error(err.Error())
}

cmd.AddArg(input)

fmt.Println("input msg :")
if _, err = fmt.Scanf("%s\n", &input); err != nil {
glog.Error(err.Error())
log.Error(err.Error())
}

cmd.AddArg(input)

fmt.Println("input my ID :")
if _, err = fmt.Scanf("%s\n", &input); err != nil {
glog.Error(err.Error())
}

cmd.AddArg(input)
cmd.AddArg(myID)

err = msgServerClient.Send(libnet.Json(cmd))
if err != nil {
glog.Error(err.Error())
log.Error(err.Error())
}
}

defer msgServerClient.Close()

// msgServerClient.Process(func(msg *libnet.InBuffer) error {
// glog.Info(string(msg.Data))
// log.Info(string(msg.Data))
// return nil
// })

glog.Flush()
log.Flush()
}
Binary file modified client/client_topic/client_topic
Binary file not shown.
Loading

0 comments on commit 50a5604

Please sign in to comment.