This sample source code contains the sample source code of GoClass Client and GoClass Server. This article describes how to run the sample source code. It is recommended that the client and server be used together. The guidelines are divided into two parts:
- Guidelines for running the sample source code of the GoClass client.
- Guidelines for running the example source code of GoClass server (Golang).
The sample code is for reference only when the developer accesses it. ZEGO is not responsible for the follow-up maintenance of the sample source code.
If the developer plans to use the sample source code in a production environment, please make sure to perform sufficient testing before release to avoid potential problems and losses.
1 GoClass Client Sample Source Code Operation Guidelines
1.1 Prepare the Environment
Please ensure that the development environment meets the following technical requirements:
- Xcode 7.0 or above.
- iOS 9.0 or above and an iOS device or simulator that supports audio and video (recommended to use a real device).
- The iOS device is connected to the Internet.
1.3 Run Sample Code
- Open the
AppStore, search for
Xcode, download and install it.
- Use Xcode to open
a. Open Xcode and select
File> Open... in the upper left corner.
src/go_class_ios/go_class.xcworkspace in the unzipped sample source code folder, and click
- Log in to your Apple ID account.
a. Open Xcode and select
Preference in the upper left corner.
b. Click the
Account tab, click the
+ sign in the lower left corner, select to add an Apple ID, and click
c. Enter Apple ID and password to log in.
- Modify the developer certificate and Bundle Identifier.
a. Open Xcode and click the
go_class project on the left.
b. Click the Signing & Capabilities tab and select your own developer certificate in Team.
- The downloaded sample source code lacks AppID and AppSign required for SDK initialization, so you need to modify the ZegoAuthConstants.h file. Please use the AppID and AppSign obtained in the "Prerequisites" of this article to fill in correctly otherwise the sample source code will not work properly.
At the same time, you need to configure the host address of the locally deployed GOClass server in the corresponding field.
Then you can set the default environment by calling the setNormalEnv method of the ZegoClassEnvManager singleton in the demo, or you can modify it to the developer's target environment in this method.
- Connect the iOS device to the development computer and click
Generic iOS Devicein the upper left corner of Xcode to select the real iOS device.
- Click the Build button in the upper left corner of Xcode to compile and run the sample source code.
2 GoClass Server (Golang) Sample Source Code Operation Guidelines
2.1 Environmental Preparation
- Golang 1.11 or above has been installed (recommended 1.13 or above).
go env -w GO111MODULE=onto turn on the golang module.
go env -w GOPROXY=https://goproxy.cnto set up golang proxy.
- Redis 2.6 or above has been installed.
2.3 Run Sample Code
- Download the GoClass source code.
git clone https://github.com/zegoim/go-class.git
The GoClass sample source code contains the GoClass client source code and server source code. If the developer has downloaded the sample source code package when running the GoClass client source code, there is no need to download it again here.
- Enter the configuration directory
- Modify the relevant configuration items in the
RedisAddr = "192.168.100.62:6379" # redis host RedisPassword = "" # redis password RedisIndex = 8 # redis database [SmallClass] # Small class class appid related configuration If you don’t need small class scene, you don’t need to care about related configuration AppId = 123456789 AppSecret = "eb2280544902dc1b7ab1fde3985bd083" # ServerSecret obtained from zego console ... MaxPeopleNum = 10 # The maximum number of people online at the same time in the classroom MaxJoinLiveNum = 4 # The maximum number of simultaneous microphones in the small class classroom [LargeClass] # Large class class appid related configuration If you don’t need large class scenario, you don’t need to care about related configuration AppId = 987654321 AppSecret = "13nce767a02dc1b7bd083ab1fde3985" # ServerSecret obtained from zego console ... MaxPeopleNum = 50 # Maximum number of simultaneous online people in large classes MaxJoinLiveNum = 1 # The maximum number of simultaneous microphones in the large class classroom
- Enter the
go_class_roomdirectory and start the service.
cd ../go_class_room go run main.go