(target *vdom.VDomTarget)
| 197 | } |
| 198 | |
| 199 | func (c *Client) CreateVDomContext(target *vdom.VDomTarget) error { |
| 200 | blockORef, err := wshclient.VDomCreateContextCommand( |
| 201 | c.RpcClient, |
| 202 | vdom.VDomCreateContext{Target: target}, |
| 203 | &wshrpc.RpcOpts{Route: wshutil.MakeFeBlockRouteId(c.RpcContext.BlockId)}, |
| 204 | ) |
| 205 | if err != nil { |
| 206 | return err |
| 207 | } |
| 208 | c.VDomContextBlockId = blockORef.OID |
| 209 | log.Printf("created vdom context: %v\n", blockORef) |
| 210 | gotRoute, err := wshclient.WaitForRouteCommand(c.RpcClient, wshrpc.CommandWaitForRouteData{ |
| 211 | RouteId: wshutil.MakeFeBlockRouteId(blockORef.OID), |
| 212 | WaitMs: 4000, |
| 213 | }, &wshrpc.RpcOpts{Timeout: 5000}) |
| 214 | if err != nil { |
| 215 | return fmt.Errorf("error waiting for vdom context route: %v", err) |
| 216 | } |
| 217 | if !gotRoute { |
| 218 | return fmt.Errorf("vdom context route could not be established") |
| 219 | } |
| 220 | wshclient.EventSubCommand(c.RpcClient, wps.SubscriptionRequest{Event: wps.Event_BlockClose, Scopes: []string{ |
| 221 | blockORef.String(), |
| 222 | }}, nil) |
| 223 | c.RpcClient.EventListener.On("blockclose", func(event *wps.WaveEvent) { |
| 224 | c.doShutdown("got blockclose event") |
| 225 | }) |
| 226 | return nil |
| 227 | } |
| 228 | |
| 229 | func (c *Client) SendAsyncInitiation() error { |
| 230 | if c.VDomContextBlockId == "" { |
no test coverage detected