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:
Platform | Remarks |
---|---|
Windows | 32-bit node |
macOS | 64-bit node |
Please go to node official website to download the software and refer to nodejs Docs to install.
Please go to ZEGO Management Console to register an account and apply for the AppID and AppSign required to initialize the SDK. For the application process, please refer to Project Management.
The downloaded sample source code lacks the APP_ID required for SDK initialization, so you need to modify the src/go_class_web/.env.development file. Please use the AppID obtained in the "Prerequisites" of this article to fill in correctly.
Please refer to Login Room Authentication to obtain the token required to log in to the room in the sample source code, and fill in the interface to obtain the token into the VUE_APP_TOKEN_URL in src/go_class_web/.env.development correctly.
VUE_APP_ZEGO_APPID=Domestic-small class
VUE_APP_ZEGO_APPID2=Overseas-small class
VUE_APP_ZEGO_APPSIGN=
VUE_APP_ZEGO_APPSIGN2=
VUE_APP_TOKEN_URL=YOUR TOKEN_URL
VUE_APP_ELECTRON_SDK=sdk type: express|liveroom; empty, express by default
VUE_APP_CONFIG_TIPS_START=The following is the business domain configuration
VUE_APP_HOME_URL=Domestic official environment address
VUE_APP_OVERSEA_URL=Overseas official environment address
VUE_APP_CONFIG_TIPS_END=The above is the business domain configuration
Switch to the directory where the project is located in Terminal and execute yarn install
or npm install
command to install dependencies.
Execute the yarn run electron:serve
or npm run electron:serve
command in the Terminal to run the sample source code, and the login window will pop up automatically after running successfully.
Execute the Control+C
command in Terminal to stop the server.
When using the npm run electron:serve
command to run the example source code, the electron window may not pop up. Due to network reasons, npm fails to download some resources. Yarn is recommended.
go env -w GO111MODULE=on
to turn on the golang module.go env -w GOPROXY=https://goproxy.cn
to set up golang proxy.Please go to ZEGO Management Console to register an account and apply for AppID and ServerSecret. Refer to Project Management.
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.
src/go_class_server/go_class_room/conf/
.cd src/go_class_server/go_class_room/conf/
app.conf
file.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 classroom
go_class_room
directory and start the service.cd ../go_class_room
go run main.go