Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
V
VRClassroom
Project
Project
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
Danny Pires
VRClassroom
Commits
1510f23a
Commit
1510f23a
authored
Feb 26, 2021
by
Geovanny Vera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some cleanup
parent
cea436ce
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
20 deletions
+8
-20
router.js
src/Instancing/ue4/router.js
+2
-2
VRCPlayerController.cpp
src/Source/VRClassroom/Private/VRCPlayerController.cpp
+6
-18
No files found.
src/Instancing/ue4/router.js
View file @
1510f23a
...
...
@@ -7,7 +7,7 @@ const router = new Router();
router
.
post
(
'/'
,
(
ctx
,
next
)
=>
{
const
body
=
ctx
.
request
.
body
;
console
.
log
(
`Server
${
body
.
name
}
`
);
const
sub
=
spawn
(
CONFIG
.
UE4_PATH
,
[
CONFIG
.
PROJECT_PATH
,
`
TestServer
?listen`
,
'-server'
,
'-log'
,
'-nosteam'
,
'-messaging'
,
`-port=
${
body
.
port
}
`
],
{
const
sub
=
spawn
(
CONFIG
.
UE4_PATH
,
[
CONFIG
.
PROJECT_PATH
,
`
${
body
.
name
}
?listen`
,
'-server'
,
'-log'
,
'-nosteam'
,
'-messaging'
,
`-port=
${
body
.
port
}
`
],
{
detached
:
true
,
stdio
:
'ignore'
});
...
...
@@ -20,7 +20,7 @@ router.post('/', (ctx, next) => {
router
.
post
(
'/classroom'
,
(
ctx
,
next
)
=>
{
const
body
=
ctx
.
request
.
body
;
console
.
log
(
`Classroom
${
body
.
name
}
`
);
const
sub
=
spawn
(
CONFIG
.
UE4_PATH
,
[
CONFIG
.
PROJECT_PATH
,
`
TestClassroom
?listen`
,
'-server'
,
'-log'
,
'-nosteam'
,
'-messaging'
,
`-port=
${
body
.
port
}
`
],
{
const
sub
=
spawn
(
CONFIG
.
UE4_PATH
,
[
CONFIG
.
PROJECT_PATH
,
`
${
body
.
name
}
?listen`
,
'-server'
,
'-log'
,
'-nosteam'
,
'-messaging'
,
`-port=
${
body
.
port
}
`
],
{
detached
:
true
,
stdio
:
'ignore'
});
...
...
src/Source/VRClassroom/Private/VRCPlayerController.cpp
View file @
1510f23a
...
...
@@ -22,27 +22,19 @@ void AVRCPlayerController::ConnectToCampus() {
}
Http
->
SetTimeout
(
TravelTimeout
);
TSharedRef
<
IHttpRequest
>
Request
=
Http
->
PostRequest
(
"dsa"
,
"asd
"
);
TSharedRef
<
IHttpRequest
>
Request
=
Http
->
GetRequest
(
"instances/join-server
"
);
Request
->
OnProcessRequestComplete
().
BindUObject
(
this
,
&
AVRCPlayerController
::
OnConnectToCampusResponseRecieved
);
Request
->
SetVerb
(
"POST"
);
Request
->
SetHeader
(
TEXT
(
"User-Agent"
),
"X-UnrealEngine-Agent"
);
Request
->
SetHeader
(
"Content-Type"
,
TEXT
(
"application/json"
));
Request
->
SetHeader
(
TEXT
(
"Accepts"
),
TEXT
(
"application/json"
));
Request
->
SetHeader
(
"Accepts"
,
TEXT
(
"application/json"
));
FString
url
=
FString
(
VRCAPIPath
+
"instances/join-server"
);
TArray
<
FStringFormatArg
>
FormatParams
;
FormatParams
.
Add
(
TEXT
(
"Geo"
));
FormatParams
.
Add
(
TEXT
(
"123"
));
FString
PostParameters
=
FString
::
Format
(
TEXT
(
"{
\"
Username
\"
:
\"
{0}
\"
,
\"
Pass
\"
:
\"
{1}
\"
}"
),
FormatParams
);
Request
->
SetURL
(
url
);
Request
->
SetContentAsString
(
PostParameters
);
Request
->
ProcessRequest
();
}
void
AVRCPlayerController
::
OnConnectToCampusResponseRecieved
(
FHttpRequestPtr
Request
,
FHttpResponsePtr
Response
,
bool
bWasSuccessful
)
{
if
(
bWasSuccessful
)
{
if
(
Http
->
ResponseIsValid
(
Response
,
bWasSuccessful
)
)
{
TSharedPtr
<
FJsonObject
>
JsonObject
;
TSharedRef
<
TJsonReader
<>>
Reader
=
TJsonReaderFactory
<>::
Create
(
Response
->
GetContentAsString
());
...
...
@@ -59,7 +51,6 @@ void AVRCPlayerController::OnConnectToCampusResponseRecieved(FHttpRequestPtr Req
}
else
{
UE_LOG
(
LogTemp
,
Error
,
TEXT
(
"OnConnectToCampus Server returned no data!"
));
}
}
else
{
...
...
@@ -77,11 +68,9 @@ void AVRCPlayerController::ConnectToMeeting(FString MeetingId) {
MeetingId
.
TrimStartAndEndInline
();
FString
PostParameters
=
FString
(
TEXT
(
"{
\"
meetingId
\"
:
\"
123
\"
}"
));
TSharedRef
<
IHttpRequest
>
Request
=
Http
->
GetRequest
(
"meeting/connect"
);
TSharedRef
<
IHttpRequest
>
Request
=
Http
->
GetRequest
(
"instances/join-classroom/123"
);
Request
->
SetURL
(
FString
(
"http://localhost:1337/instances/join-classroom/123"
));
Request
->
SetHeader
(
"
Content-Type
"
,
TEXT
(
"application/json"
));
Request
->
SetHeader
(
"
Accepts
"
,
TEXT
(
"application/json"
));
Request
->
OnProcessRequestComplete
().
BindUObject
(
this
,
&
AVRCPlayerController
::
OnConnectToMeetingResponseRecieved
);
Request
->
ProcessRequest
();
...
...
@@ -89,7 +78,6 @@ void AVRCPlayerController::ConnectToMeeting(FString MeetingId) {
void
AVRCPlayerController
::
OnConnectToMeetingResponseRecieved
(
FHttpRequestPtr
Request
,
FHttpResponsePtr
Response
,
bool
bWasSuccessful
)
{
FString
content
=
*
Response
->
GetContentAsString
();
UE_LOG
(
LogTemp
,
Log
,
TEXT
(
"asdsad"
));
if
(
Http
->
ResponseIsValid
(
Response
,
bWasSuccessful
)){
UE_LOG
(
LogTemp
,
Log
,
TEXT
(
"Connecting to meeting"
));
...
...
@@ -107,7 +95,7 @@ void AVRCPlayerController::OnConnectToMeetingResponseRecieved(FHttpRequestPtr Re
TravelToMap
(
URL
,
false
);
}
else
{
UE_LOG
(
LogTemp
,
Error
,
TEXT
(
"OnConnectTo
Campus
Server returned no data!"
));
UE_LOG
(
LogTemp
,
Error
,
TEXT
(
"OnConnectTo
Meeting
Server returned no data!"
));
}
}
else
{
...
...
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