MCPcopy Index your code
hub / github.com/koding/kite / Register

Method Register

kontrolclient.go:356–391  ·  view source on GitHub ↗

Register registers current Kite to Kontrol. After registration other Kites can find it via GetKites() or WatchKites() method. This method does not handle the reconnection case. If you want to keep registered to kontrol, use RegisterForever().

(kiteURL *url.URL)

Source from the content-addressed store, hash-verified

354// handle the reconnection case. If you want to keep registered to kontrol, use
355// RegisterForever().
356func (k *Kite) Register(kiteURL *url.URL) (*registerResult, error) {
357 if err := k.SetupKontrolClient(); err != nil {
358 return nil, err
359 }
360
361 <-k.kontrol.readyConnected
362
363 args := protocol.RegisterArgs{
364 URL: kiteURL.String(),
365 }
366
367 k.Log.Info("Registering to kontrol with URL: %s", kiteURL.String())
368
369 response, err := k.kontrol.TellWithTimeout("register", k.Config.Timeout, args)
370 if err != nil {
371 return nil, err
372 }
373
374 var rr protocol.RegisterResult
375 err = response.Unmarshal(&rr)
376 if err != nil {
377 return nil, err
378 }
379
380 k.Log.Info("Registered to kontrol with URL: %s and Kite query: %s",
381 rr.URL, k.Kite())
382
383 parsed, err := url.Parse(rr.URL)
384 if err != nil {
385 k.Log.Error("Cannot parse registered URL: %s", err)
386 }
387
388 k.callOnRegisterHandlers(&rr)
389
390 return &registerResult{parsed}, nil
391}
392
393// RegisterToTunnel finds a tunnel proxy kite by asking kontrol then registers
394// itself on proxy. On error, retries forever. On every successful

Callers 2

RegisterForeverMethod · 0.95
TestWebSocketProxyFunction · 0.45

Calls 8

SetupKontrolClientMethod · 0.95
KiteMethod · 0.95
InfoMethod · 0.80
TellWithTimeoutMethod · 0.80
UnmarshalMethod · 0.80
ErrorMethod · 0.65
StringMethod · 0.45

Tested by 1

TestWebSocketProxyFunction · 0.36