Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cmu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李维杰
cmu
Commits
c58b6f67
Commit
c58b6f67
authored
Jun 18, 2020
by
李维杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add response
parent
b0a69d11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
11 deletions
+68
-11
mqtt_request.cc
thirdparty/mqtt/mqtt_request.cc
+61
-9
mqtt_request.h
thirdparty/mqtt/mqtt_request.h
+7
-2
No files found.
thirdparty/mqtt/mqtt_request.cc
View file @
c58b6f67
...
...
@@ -7,29 +7,51 @@ namespace offcn
{
"path": "join",
"rid" : "xxxid",
"
capacity
" :
"
data
" :
{
"pull_type" : "
rtmp
"
"pull_type" : "
null
"
}
}
*/
std
::
string
MqttRequest
::
JoinRequest
(
std
::
string
local_id
,
std
::
string
capacity
)
std
::
string
MqttRequest
::
JoinRequest
(
std
::
string
local_id
)
{
return
""
;
Json
::
Value
root
;
Json
::
StreamWriterBuilder
wBuilder
;
root
[
"path"
]
=
"join"
;
root
[
"rid"
]
=
local_id
;
Json
::
Value
data
;
data
[
"pull_type"
]
=
"null"
;
root
[
"data"
]
=
data
;
return
Json
::
writeString
(
wBuilder
,
root
);
}
/*
{
"path": "update",
"rid" : "xxxid",
"
capacity
" :
"
data
" :
{
"pull_type" : "kcp"
"pull_type" : "
rtmp" or "null" or "
kcp"
}
}
*/
std
::
string
MqttRequest
::
UpdateRequest
(
std
::
string
local_id
,
std
::
string
capacity
)
std
::
string
MqttRequest
::
UpdateRequest
(
std
::
string
local_id
,
std
::
string
pull_type
)
{
return
""
;
Json
::
Value
root
;
Json
::
StreamWriterBuilder
wBuilder
;
root
[
"path"
]
=
"update"
;
root
[
"rid"
]
=
local_id
;
Json
::
Value
data
;
data
[
"pull_type"
]
=
pull_type
;
root
[
"data"
]
=
data
;
return
Json
::
writeString
(
wBuilder
,
root
);
}
/*
{
...
...
@@ -41,6 +63,35 @@ namespace offcn
*/
std
::
string
MqttRequest
::
Candidate
(
std
::
string
local_id
,
std
::
string
remote_id
,
std
::
string
type
,
std
::
string
candidate
)
{
return
""
;
Json
::
Value
root
;
Json
::
StreamWriterBuilder
wBuilder
;
root
[
"path"
]
=
type
;
root
[
"rid"
]
=
local_id
;
root
[
"tid"
]
=
remote_id
;
root
[
"candidate"
]
=
candidate
;
return
Json
::
writeString
(
wBuilder
,
root
);
}
std
::
string
MqttRequest
::
JoinResponse
(
std
::
string
ids
,
std
::
string
result
)
{
Json
::
Value
root
;
Json
::
StreamWriterBuilder
wBuilder
;
root
[
"path"
]
=
"join"
;
root
[
"result"
]
=
result
;
return
Json
::
writeString
(
wBuilder
,
root
);
}
std
::
string
MqttRequest
::
UpdateResponse
(
std
::
string
result
)
{
Json
::
Value
root
;
Json
::
StreamWriterBuilder
wBuilder
;
root
[
"path"
]
=
"update"
;
root
[
"result"
]
=
result
;
return
Json
::
writeString
(
wBuilder
,
root
);
}
}
\ No newline at end of file
thirdparty/mqtt/mqtt_request.h
View file @
c58b6f67
...
...
@@ -7,8 +7,12 @@ namespace offcn
class
MqttRequest
{
public
:
static
std
::
string
JoinRequest
(
std
::
string
local_id
,
std
::
string
capacity
);
static
std
::
string
UpdateRequest
(
std
::
string
local_id
,
std
::
string
capacity
);
static
std
::
string
JoinRequest
(
std
::
string
local_id
);
static
std
::
string
UpdateRequest
(
std
::
string
local_id
,
std
::
string
pull_type
);
static
std
::
string
Candidate
(
std
::
string
local_id
,
std
::
string
remote_id
,
std
::
string
type
,
std
::
string
candidate
);
static
std
::
string
JoinResponse
(
std
::
string
ids
,
std
::
string
result
);
static
std
::
string
UpdateResponse
(
std
::
string
result
);
};
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment