github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/api/webrtc.go (about) 1 // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package api 5 6 import ( 7 "net/http" 8 ) 9 10 func (api *API) InitWebrtc() { 11 api.BaseRoutes.Webrtc.Handle("/token", api.ApiUserRequired(webrtcToken)).Methods("POST") 12 } 13 14 func webrtcToken(c *Context, w http.ResponseWriter, r *http.Request) { 15 result, err := c.App.GetWebrtcInfoForSession(c.Session.Id) 16 17 if err != nil { 18 c.Err = err 19 return 20 } 21 22 w.Write([]byte(result.ToJson())) 23 }