Debian Codegraph @

doc/output/html/cockpit-dbus.html

raw
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <meta name="generator" content="Asciidoctor 2.0.26">
8 <title>cockpit.js: DBus Client</title>
9 <style>
10 /*! Asciidoctor default stylesheet | MIT License | https://asciidoctor.org */
11 /* Uncomment the following line when using as a custom stylesheet */
12 /* @import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"; */
13 html{font-family:sans-serif;-webkit-text-size-adjust:100%}
14 a{background:none}
15 a:focus{outline:thin dotted}
16 a:active,a:hover{outline:0}
17 h1{font-size:2em;margin:.67em 0}
18 b,strong{font-weight:bold}
19 abbr{font-size:.9em}
20 abbr[title]{cursor:help;border-bottom:1px dotted #dddddf;text-decoration:none}
21 dfn{font-style:italic}
22 hr{height:0}
23 mark{background:#ff0;color:#000}
24 code,kbd,pre,samp{font-family:monospace;font-size:1em}
25 pre{white-space:pre-wrap}
26 q{quotes:"\201C" "\201D" "\2018" "\2019"}
27 small{font-size:80%}
28 sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
29 sup{top:-.5em}
30 sub{bottom:-.25em}
31 img{border:0}
32 svg:not(:root){overflow:hidden}
33 figure{margin:0}
34 audio,video{display:inline-block}
35 audio:not([controls]){display:none;height:0}
36 fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
37 legend{border:0;padding:0}
38 button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}
39 button,input{line-height:normal}
40 button,select{text-transform:none}
41 button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}
42 button[disabled],html input[disabled]{cursor:default}
43 input[type=checkbox],input[type=radio]{padding:0}
44 button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
45 textarea{overflow:auto;vertical-align:top}
46 table{border-collapse:collapse;border-spacing:0}
47 *,::before,::after{box-sizing:border-box}
48 html,body{font-size:100%}
49 body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;line-height:1;position:relative;cursor:auto;-moz-tab-size:4;-o-tab-size:4;tab-size:4;word-wrap:anywhere;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}
50 a:hover{cursor:pointer}
51 img,object,embed{max-width:100%;height:auto}
52 object,embed{height:100%}
53 img{-ms-interpolation-mode:bicubic}
54 .left{float:left!important}
55 .right{float:right!important}
56 .text-left{text-align:left!important}
57 .text-right{text-align:right!important}
58 .text-center{text-align:center!important}
59 .text-justify{text-align:justify!important}
60 .hide{display:none}
61 img,object,svg{display:inline-block;vertical-align:middle}
62 textarea{height:auto;min-height:50px}
63 select{width:100%}
64 .subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em}
65 div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0}
66 a{color:#2156a5;text-decoration:underline;line-height:inherit}
67 a:hover,a:focus{color:#1d4b8f}
68 a img{border:0}
69 p{line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}
70 p aside{font-size:.875em;line-height:1.35;font-style:italic}
71 h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em}
72 h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0}
73 h1{font-size:2.125em}
74 h2{font-size:1.6875em}
75 h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}
76 h4,h5{font-size:1.125em}
77 h6{font-size:1em}
78 hr{border:solid #dddddf;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em}
79 em,i{font-style:italic;line-height:inherit}
80 strong,b{font-weight:bold;line-height:inherit}
81 small{font-size:60%;line-height:inherit}
82 code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)}
83 ul,ol,dl{line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}
84 ul,ol{margin-left:1.5em}
85 ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0}
86 ul.circle{list-style-type:circle}
87 ul.disc{list-style-type:disc}
88 ul.square{list-style-type:square}
89 ul.circle ul:not([class]),ul.disc ul:not([class]),ul.square ul:not([class]){list-style:inherit}
90 ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}
91 dl dt{margin-bottom:.3125em;font-weight:bold}
92 dl dd{margin-bottom:1.25em}
93 blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}
94 blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)}
95 @media screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}
96 h1{font-size:2.75em}
97 h2{font-size:2.3125em}
98 h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em}
99 h4{font-size:1.4375em}}
100 table{background:#fff;margin-bottom:1.25em;border:1px solid #dedede;word-wrap:normal}
101 table thead,table tfoot{background:#f7f8f7}
102 table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left}
103 table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)}
104 table tr.even,table tr.alt{background:#f8f8f7}
105 table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{line-height:1.6}
106 h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em}
107 h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400}
108 .center{margin-left:auto;margin-right:auto}
109 .stretch{width:100%}
110 .clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:" ";display:table}
111 .clearfix::after,.float-group::after{clear:both}
112 :not(pre).nobreak{word-wrap:normal}
113 :not(pre).nowrap{white-space:nowrap}
114 :not(pre).pre-wrap{white-space:pre-wrap}
115 :not(pre):not([class^=L])>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background:#f7f7f8;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed}
116 pre{color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;line-height:1.45;text-rendering:optimizeSpeed}
117 pre code,pre pre{color:inherit;font-size:inherit;line-height:inherit}
118 pre.nowrap,pre.nowrap pre{white-space:pre;word-wrap:normal}
119 em em{font-style:normal}
120 strong strong{font-weight:400}
121 .keyseq{color:rgba(51,51,51,.8)}
122 kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background:#f7f7f7;border:1px solid #ccc;border-radius:3px;box-shadow:0 1px 0 rgba(0,0,0,.2),inset 0 0 0 .1em #fff;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap}
123 .keyseq kbd:first-child{margin-left:0}
124 .keyseq kbd:last-child{margin-right:0}
125 .menuseq,.menuref{color:#000}
126 .menuseq b:not(.caret),.menuref{font-weight:inherit}
127 .menuseq{word-spacing:-.02em}
128 .menuseq b.caret{font-size:1.25em;line-height:.8}
129 .menuseq i.caret{font-weight:bold;text-align:center;width:.45em}
130 b.button::before,b.button::after{position:relative;top:-1px;font-weight:400}
131 b.button::before{content:"[";padding:0 3px 0 2px}
132 b.button::after{content:"]";padding:0 2px 0 3px}
133 p a>code:hover{color:rgba(0,0,0,.9)}
134 #header,#content,#footnotes,#footer{width:100%;margin:0 auto;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em}
135 #header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:" ";display:table}
136 #header::after,#content::after,#footnotes::after,#footer::after{clear:both}
137 #content{margin-top:1.25em}
138 #content::before{content:none}
139 #header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}
140 #header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #dddddf}
141 #header>h1:only-child{border-bottom:1px solid #dddddf;padding-bottom:8px}
142 #header .details{border-bottom:1px solid #dddddf;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:flex;flex-flow:row wrap}
143 #header .details span:first-child{margin-left:-.125em}
144 #header .details span.email a{color:rgba(0,0,0,.85)}
145 #header .details br{display:none}
146 #header .details br+span::before{content:"\00a0\2013\00a0"}
147 #header .details br+span.author::before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)}
148 #header .details br+span#revremark::before{content:"\00a0|\00a0"}
149 #header #revnumber{text-transform:capitalize}
150 #header #revnumber::after{content:"\00a0"}
151 #content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #dddddf;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem}
152 #toc{border-bottom:1px solid #e7e7e9;padding-bottom:.5em}
153 #toc>ul{margin-left:.125em}
154 #toc ul.sectlevel0>li>a{font-style:italic}
155 #toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0}
156 #toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none}
157 #toc li{line-height:1.3334;margin-top:.3334em}
158 #toc a{text-decoration:none}
159 #toc a:active{text-decoration:underline}
160 #toctitle{color:#7a2518;font-size:1.2em}
161 @media screen and (min-width:768px){#toctitle{font-size:1.375em}
162 body.toc2{padding-left:15em;padding-right:0}
163 body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px}
164 #toc.toc2{margin-top:0!important;background:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #e7e7e9;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}
165 #toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em}
166 #toc.toc2>ul{font-size:.9em;margin-bottom:0}
167 #toc.toc2 ul ul{margin-left:0;padding-left:1em}
168 #toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}
169 body.toc2.toc-right{padding-left:0;padding-right:15em}
170 body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #e7e7e9;left:auto;right:0}}
171 @media screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0}
172 #toc.toc2{width:20em}
173 #toc.toc2 #toctitle{font-size:1.375em}
174 #toc.toc2>ul{font-size:.95em}
175 #toc.toc2 ul ul{padding-left:1.25em}
176 body.toc2.toc-right{padding-left:0;padding-right:20em}}
177 #content #toc{border:1px solid #e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;border-radius:4px}
178 #content #toc>:first-child{margin-top:0}
179 #content #toc>:last-child{margin-bottom:0}
180 #footer{max-width:none;background:rgba(0,0,0,.8);padding:1.25em}
181 #footer-text{color:hsla(0,0%,100%,.8);line-height:1.44}
182 #content{margin-bottom:.625em}
183 .sect1{padding-bottom:.625em}
184 @media screen and (min-width:768px){#content{margin-bottom:1.25em}
185 .sect1{padding-bottom:1.25em}}
186 .sect1:last-child{padding-bottom:0}
187 .sect1+.sect1{border-top:1px solid #e7e7e9}
188 #content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}
189 #content h1>a.anchor::before,h2>a.anchor::before,h3>a.anchor::before,#toctitle>a.anchor::before,.sidebarblock>.content>.title>a.anchor::before,h4>a.anchor::before,h5>a.anchor::before,h6>a.anchor::before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em}
190 #content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}
191 #content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none}
192 #content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221}
193 details,.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}
194 details{margin-left:1.25rem}
195 details>summary{cursor:pointer;display:block;position:relative;line-height:1.6;margin-bottom:.625rem;outline:none;-webkit-tap-highlight-color:transparent}
196 details>summary::-webkit-details-marker{display:none}
197 details>summary::before{content:"";border:solid transparent;border-left:solid;border-width:.3em 0 .3em .5em;position:absolute;top:.5em;left:-1.25rem;transform:translateX(15%)}
198 details[open]>summary::before{border:solid transparent;border-top:solid;border-width:.5em .3em 0;transform:translateY(15%)}
199 details>summary::after{content:"";width:1.25rem;height:1em;position:absolute;top:.3em;left:-1.25rem}
200 .admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic}
201 table.tableblock.fit-content>caption.title{white-space:nowrap;width:0}
202 .paragraph.lead>p,#preamble>.sectionbody>[class=paragraph]:first-of-type p{font-size:1.21875em;line-height:1.6;color:rgba(0,0,0,.85)}
203 .admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
204 .admonitionblock>table td.icon{text-align:center;width:80px}
205 .admonitionblock>table td.icon img{max-width:none}
206 .admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase}
207 .admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #dddddf;color:rgba(0,0,0,.6);word-wrap:anywhere}
208 .admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
209 .exampleblock>.content{border:1px solid #e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;border-radius:4px}
210 .sidebarblock{border:1px solid #dbdbd6;margin-bottom:1.25em;padding:1.25em;background:#f3f3f2;border-radius:4px}
211 .sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}
212 .exampleblock>.content>:first-child,.sidebarblock>.content>:first-child{margin-top:0}
213 .exampleblock>.content>:last-child,.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}
214 .literalblock pre,.listingblock>.content>pre{border-radius:4px;overflow-x:auto;padding:1em;font-size:.8125em}
215 @media screen and (min-width:768px){.literalblock pre,.listingblock>.content>pre{font-size:.90625em}}
216 @media screen and (min-width:1280px){.literalblock pre,.listingblock>.content>pre{font-size:1em}}
217 .literalblock pre,.listingblock>.content>pre:not(.highlight),.listingblock>.content>pre[class=highlight],.listingblock>.content>pre[class^="highlight "]{background:#f7f7f8}
218 .literalblock.output pre{color:#f7f7f8;background:rgba(0,0,0,.9)}
219 .listingblock>.content{position:relative}
220 .listingblock pre>code{display:block}
221 .listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:inherit;opacity:.5}
222 .listingblock:hover code[data-lang]::before{display:block}
223 .listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:.5em;color:inherit;opacity:.5}
224 .listingblock.terminal pre .command:not([data-prompt])::before{content:"$"}
225 .listingblock pre.highlightjs{padding:0}
226 .listingblock pre.highlightjs>code{padding:1em;border-radius:4px}
227 .listingblock pre.prettyprint{border-width:0}
228 .prettyprint{background:#f7f7f8}
229 pre.prettyprint .linenums{line-height:1.45;margin-left:2em}
230 pre.prettyprint li{background:none;list-style-type:inherit;padding-left:0}
231 pre.prettyprint li code[data-lang]::before{opacity:1}
232 pre.prettyprint li:not(:first-child) code[data-lang]::before{display:none}
233 table.linenotable{border-collapse:separate;border:0;margin-bottom:0;background:none}
234 table.linenotable td[class]{color:inherit;vertical-align:top;padding:0;line-height:inherit;white-space:normal}
235 table.linenotable td.code{padding-left:.75em}
236 table.linenotable td.linenos,pre.pygments .linenos{border-right:1px solid;opacity:.35;padding-right:.5em;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
237 pre.pygments span.linenos{display:inline-block;margin-right:.75em}
238 .quoteblock{margin:0 1em 1.25em 1.5em;display:table}
239 .quoteblock:not(.excerpt)>.title{margin-left:-1.5em;margin-bottom:.75em}
240 .quoteblock blockquote,.quoteblock p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}
241 .quoteblock blockquote{margin:0;padding:0;border:0}
242 .quoteblock blockquote::before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}
243 .quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}
244 .quoteblock .attribution{margin-top:.75em;margin-right:.5ex;text-align:right}
245 .verseblock{margin:0 1em 1.25em}
246 .verseblock pre{font-family:"Open Sans","DejaVu Sans",sans-serif;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}
247 .verseblock pre strong{font-weight:400}
248 .verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}
249 .quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}
250 .quoteblock .attribution br,.verseblock .attribution br{display:none}
251 .quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)}
252 .quoteblock.abstract blockquote::before,.quoteblock.excerpt blockquote::before,.quoteblock .quoteblock blockquote::before{display:none}
253 .quoteblock.abstract blockquote,.quoteblock.abstract p,.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{line-height:1.6;word-spacing:0}
254 .quoteblock.abstract{margin:0 1em 1.25em;display:block}
255 .quoteblock.abstract>.title{margin:0 0 .375em;font-size:1.15em;text-align:center}
256 .quoteblock.excerpt>blockquote,.quoteblock .quoteblock{padding:0 0 .25em 1em;border-left:.25em solid #dddddf}
257 .quoteblock.excerpt,.quoteblock .quoteblock{margin-left:0}
258 .quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{color:inherit;font-size:1.0625rem}
259 .quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;font-size:.85rem;text-align:left;margin-right:0}
260 p.tableblock:last-child{margin-bottom:0}
261 td.tableblock>.content{margin-bottom:1.25em;word-wrap:anywhere}
262 td.tableblock>.content>:last-child{margin-bottom:-1.25em}
263 table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
264 table.grid-all>*>tr>*{border-width:1px}
265 table.grid-cols>*>tr>*{border-width:0 1px}
266 table.grid-rows>*>tr>*{border-width:1px 0}
267 table.frame-all{border-width:1px}
268 table.frame-ends{border-width:1px 0}
269 table.frame-sides{border-width:0 1px}
270 table.frame-none>colgroup+*>:first-child>*,table.frame-sides>colgroup+*>:first-child>*{border-top-width:0}
271 table.frame-none>:last-child>:last-child>*,table.frame-sides>:last-child>:last-child>*{border-bottom-width:0}
272 table.frame-none>*>tr>:first-child,table.frame-ends>*>tr>:first-child{border-left-width:0}
273 table.frame-none>*>tr>:last-child,table.frame-ends>*>tr>:last-child{border-right-width:0}
274 table.stripes-all>*>tr,table.stripes-odd>*>tr:nth-of-type(odd),table.stripes-even>*>tr:nth-of-type(even),table.stripes-hover>*>tr:hover{background:#f8f8f7}
275 th.halign-left,td.halign-left{text-align:left}
276 th.halign-right,td.halign-right{text-align:right}
277 th.halign-center,td.halign-center{text-align:center}
278 th.valign-top,td.valign-top{vertical-align:top}
279 th.valign-bottom,td.valign-bottom{vertical-align:bottom}
280 th.valign-middle,td.valign-middle{vertical-align:middle}
281 table thead th,table tfoot th{font-weight:bold}
282 tbody tr th{background:#f7f8f7}
283 tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}
284 p.tableblock>code:only-child{background:none;padding:0}
285 p.tableblock{font-size:1em}
286 ol{margin-left:1.75em}
287 ul li ol{margin-left:1.5em}
288 dl dd{margin-left:1.125em}
289 dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
290 li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
291 ul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none}
292 ul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em}
293 ul.unstyled,ol.unstyled{margin-left:0}
294 li>p:empty:only-child::before{content:"";display:inline-block}
295 ul.checklist>li>p:first-child{margin-left:-1em}
296 ul.checklist>li>p:first-child>.fa-square-o:first-child,ul.checklist>li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em}
297 ul.checklist>li>p:first-child>input[type=checkbox]:first-child{margin-right:.25em}
298 ul.inline{display:flex;flex-flow:row wrap;list-style:none;margin:0 0 .625em -1.25em}
299 ul.inline>li{margin-left:1.25em}
300 .unstyled dl dt{font-weight:400;font-style:normal}
301 ol.arabic{list-style-type:decimal}
302 ol.decimal{list-style-type:decimal-leading-zero}
303 ol.loweralpha{list-style-type:lower-alpha}
304 ol.upperalpha{list-style-type:upper-alpha}
305 ol.lowerroman{list-style-type:lower-roman}
306 ol.upperroman{list-style-type:upper-roman}
307 ol.lowergreek{list-style-type:lower-greek}
308 .hdlist>table,.colist>table{border:0;background:none}
309 .hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}
310 td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em}
311 td.hdlist1{font-weight:bold;padding-bottom:1.25em}
312 td.hdlist2{word-wrap:anywhere}
313 .literalblock+.colist,.listingblock+.colist{margin-top:-.5em}
314 .colist td:not([class]):first-child{padding:.4em .75em 0;line-height:1;vertical-align:top}
315 .colist td:not([class]):first-child img{max-width:none}
316 .colist td:not([class]):last-child{padding:.25em 0}
317 .thumb,.th{line-height:0;display:inline-block;border:4px solid #fff;box-shadow:0 0 0 1px #ddd}
318 .imageblock.left{margin:.25em .625em 1.25em 0}
319 .imageblock.right{margin:.25em 0 1.25em .625em}
320 .imageblock>.title{margin-bottom:0}
321 .imageblock.thumb,.imageblock.th{border-width:6px}
322 .imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}
323 .image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}
324 .image.left{margin-right:.625em}
325 .image.right{margin-left:.625em}
326 a.image{text-decoration:none;display:inline-block}
327 a.image object{pointer-events:none}
328 sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super}
329 sup.footnote a,sup.footnoteref a{text-decoration:none}
330 sup.footnote a:active,sup.footnoteref a:active,#footnotes .footnote a:first-of-type:active{text-decoration:underline}
331 #footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}
332 #footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0}
333 #footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em}
334 #footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-1.05em}
335 #footnotes .footnote:last-of-type{margin-bottom:0}
336 #content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}
337 div.unbreakable{page-break-inside:avoid}
338 .big{font-size:larger}
339 .small{font-size:smaller}
340 .underline{text-decoration:underline}
341 .overline{text-decoration:overline}
342 .line-through{text-decoration:line-through}
343 .aqua{color:#00bfbf}
344 .aqua-background{background:#00fafa}
345 .black{color:#000}
346 .black-background{background:#000}
347 .blue{color:#0000bf}
348 .blue-background{background:#0000fa}
349 .fuchsia{color:#bf00bf}
350 .fuchsia-background{background:#fa00fa}
351 .gray{color:#606060}
352 .gray-background{background:#7d7d7d}
353 .green{color:#006000}
354 .green-background{background:#007d00}
355 .lime{color:#00bf00}
356 .lime-background{background:#00fa00}
357 .maroon{color:#600000}
358 .maroon-background{background:#7d0000}
359 .navy{color:#000060}
360 .navy-background{background:#00007d}
361 .olive{color:#606000}
362 .olive-background{background:#7d7d00}
363 .purple{color:#600060}
364 .purple-background{background:#7d007d}
365 .red{color:#bf0000}
366 .red-background{background:#fa0000}
367 .silver{color:#909090}
368 .silver-background{background:#bcbcbc}
369 .teal{color:#006060}
370 .teal-background{background:#007d7d}
371 .white{color:#bfbfbf}
372 .white-background{background:#fafafa}
373 .yellow{color:#bfbf00}
374 .yellow-background{background:#fafa00}
375 span.icon>.fa{cursor:default}
376 a span.icon>.fa{cursor:inherit}
377 .admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
378 .admonitionblock td.icon .icon-note::before{content:"\f05a";color:#19407c}
379 .admonitionblock td.icon .icon-tip::before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
380 .admonitionblock td.icon .icon-warning::before{content:"\f071";color:#bf6900}
381 .admonitionblock td.icon .icon-caution::before{content:"\f06d";color:#bf3400}
382 .admonitionblock td.icon .icon-important::before{content:"\f06a";color:#bf0000}
383 .conum[data-value]{display:inline-block;color:#fff!important;background:rgba(0,0,0,.8);border-radius:50%;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
384 .conum[data-value] *{color:#fff!important}
385 .conum[data-value]+b{display:none}
386 .conum[data-value]::after{content:attr(data-value)}
387 pre .conum[data-value]{position:relative;top:-.125em}
388 b.conum *{color:inherit!important}
389 .conum:not([data-value]):empty{display:none}
390 dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}
391 h1,h2,p,td.content,span.alt,summary{letter-spacing:-.01em}
392 p strong,td.content strong,div.footnote strong{letter-spacing:-.005em}
393 p,blockquote,dt,td.content,td.hdlist1,span.alt,summary{font-size:1.0625rem}
394 p{margin-bottom:1.25rem}
395 .sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}
396 .exampleblock>.content{background:#fffef7;border-color:#e0e0dc;box-shadow:0 1px 4px #e0e0dc}
397 .print-only{display:none!important}
398 @page{margin:1.25cm .75cm}
399 @media print{*{box-shadow:none!important;text-shadow:none!important}
400 html{font-size:80%}
401 a{color:inherit!important;text-decoration:underline!important}
402 a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
403 a[href^="http:"]:not(.bare)::after,a[href^="https:"]:not(.bare)::after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
404 abbr[title]{border-bottom:1px dotted}
405 abbr[title]::after{content:" (" attr(title) ")"}
406 pre,blockquote,tr,img,object,svg{page-break-inside:avoid}
407 thead{display:table-header-group}
408 svg{max-width:100%}
409 p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}
410 h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}
411 #header,#content,#footnotes,#footer{max-width:none}
412 #toc,.sidebarblock,.exampleblock>.content{background:none!important}
413 #toc{border-bottom:1px solid #dddddf!important;padding-bottom:0!important}
414 body.book #header{text-align:center}
415 body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em}
416 body.book #header .details{border:0!important;display:block;padding:0!important}
417 body.book #header .details span:first-child{margin-left:0!important}
418 body.book #header .details br{display:block}
419 body.book #header .details br+span::before{content:none!important}
420 body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}
421 body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}
422 .listingblock code[data-lang]::before{display:block}
423 #footer{padding:0 .9375em}
424 .hide-on-print{display:none!important}
425 .print-only{display:block!important}
426 .hide-for-print{display:none!important}
427 .show-for-print{display:inherit!important}}
428 @media amzn-kf8,print{#header>h1:first-child{margin-top:1.25rem}
429 .sect1{padding:0!important}
430 .sect1+.sect1{border:0}
431 #footer{background:none}
432 #footer-text{color:rgba(0,0,0,.6);font-size:.9em}}
433 @media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}}
434 </style>
435 </head>
436 <body class="article toc2 toc-left">
437 <div id="header">
438 <h1>cockpit.js: DBus Client</h1>
439 <div id="toc" class="toc2">
440 <div id="toctitle">Table of Contents</div>
441 <ul class="sectlevel1">
442 <li><a href="#cockpit-dbus-types">DBus Types</a></li>
443 <li><a href="#cockpit-dbus-dbus">cockpit.dbus()</a></li>
444 <li><a href="#cockpit-dbus-wait">client.wait()</a></li>
445 <li><a href="#cockpit-dbus-close">client.close()</a></li>
446 <li><a href="#cockpit-dbus-onclose">client.onclose</a></li>
447 <li><a href="#cockpit-dbus-onowned">client.onowner</a></li>
448 <li><a href="#cockpit-dbus-options">client.options</a></li>
449 <li><a href="#cockpit-dbus-unique-name">client.unique_name</a></li>
450 <li><a href="#cockpit-dbus-proxy">client.proxy()</a></li>
451 <li><a href="#cockpit-dbus-proxy-client">proxy.client</a></li>
452 <li><a href="#cockpit-dbus-proxy-path">proxy.path</a></li>
453 <li><a href="#cockpit-dbus-proxy-iface">proxy.iface</a></li>
454 <li><a href="#cockpit-dbus-proxy-valid">proxy.valid</a></li>
455 <li><a href="#cockpit-dbus-proxy-data">proxy.data</a></li>
456 <li><a href="#cockpit-dbus-proxy-call">proxy.call()</a></li>
457 <li><a href="#cockpit-dbus-proxy-wait">proxy.wait()</a></li>
458 <li><a href="#cockpit-dbus-proxy-onchanged">proxy.onchanged</a></li>
459 <li><a href="#cockpit-dbus-proxy-signal">proxy.onsignal</a></li>
460 <li><a href="#cockpit-dbus-proxies">client.proxies()</a></li>
461 <li><a href="#cockpit-dbus-proxies-wait">proxies.wait()</a></li>
462 <li><a href="#cockpit-dbus-proxies-client">proxies.client</a></li>
463 <li><a href="#cockpit-dbus-proxies-iface">proxies.iface</a></li>
464 <li><a href="#cockpit-dbus-proxies-path_namespace">proxies.path_namespace</a></li>
465 <li><a href="#cockpit-dbus-proxies-onadded">proxies.onadded</a></li>
466 <li><a href="#cockpit-dbus-proxies-onchanged">proxies.onchanged</a></li>
467 <li><a href="#cockpit-dbus-proxies-onremoved">proxies.onremoved</a></li>
468 <li><a href="#cockpit-dbus-call">client.call()</a></li>
469 <li><a href="#cockpit-dbus-then">invocation.then()</a></li>
470 <li><a href="#cockpit-dbus-catch">invocation.catch()</a></li>
471 <li><a href="#cockpit-dbus-subscribe">client.subscribe()</a></li>
472 <li><a href="#cockpit-dbus-remove">subscription.remove()</a></li>
473 <li><a href="#cockpit-dbus-watch">client.watch()</a></li>
474 <li><a href="#cockpit-dbus-watch-then">watch.then()</a></li>
475 <li><a href="#cockpit-dbus-watch-catch">watch.catch()</a></li>
476 <li><a href="#cockpit-dbus-watch-remove">watch.remove()</a></li>
477 <li><a href="#cockpit-dbus-onnotify">client.onnotify</a></li>
478 <li><a href="#cockpit-dbus-notify">client.notify()</a></li>
479 <li><a href="#cockpit-dbus-onmeta">client.onmeta</a></li>
480 <li><a href="#cockpit-dbus-variant">cockpit.variant()</a></li>
481 </ul>
482 </div>
483 </div>
484 <div id="content">
485 <div id="preamble">
486 <div class="sectionbody">
487 <div class="paragraph">
488 <p>Cockpit allows access to DBus services via this API.</p>
489 </div>
490 </div>
491 </div>
492 <div class="sect1">
493 <h2 id="cockpit-dbus-types">DBus Types</h2>
494 <div class="sectionbody">
495 <div class="paragraph">
496 <p>DBus values are represented as javascript values and objects as follows:</p>
497 </div>
498 <div class="dlist">
499 <dl>
500 <dt class="hdlist1"><code>BYTE 'y'</code></dt>
501 <dd>
502 <p>Javascript number.</p>
503 </dd>
504 <dt class="hdlist1"><code>BOOLEAN 'b'</code></dt>
505 <dd>
506 <p>Javascript boolean.</p>
507 </dd>
508 <dt class="hdlist1"><code>INT16 'n'</code></dt>
509 <dd>
510 <p>Javascript number.</p>
511 </dd>
512 <dt class="hdlist1"><code>UINT16 'q'</code></dt>
513 <dd>
514 <p>Javascript number.</p>
515 </dd>
516 <dt class="hdlist1"><code>INT32 'i'</code></dt>
517 <dd>
518 <p>Javascript number.</p>
519 </dd>
520 <dt class="hdlist1"><code>UINT32 'u'</code></dt>
521 <dd>
522 <p>Javascript number.</p>
523 </dd>
524 <dt class="hdlist1"><code>INT64 'x'</code></dt>
525 <dd>
526 <p>Javascript number.</p>
527 </dd>
528 <dt class="hdlist1"><code>UINT64 't'</code></dt>
529 <dd>
530 <p>Javascript number.</p>
531 </dd>
532 <dt class="hdlist1"><code>DOUBLE 'd'</code></dt>
533 <dd>
534 <p>Javascript number.</p>
535 </dd>
536 <dt class="hdlist1"><code>STRING 's'</code></dt>
537 <dd>
538 <p>Javascript string.</p>
539 </dd>
540 <dt class="hdlist1"><code>OBJECT_PATH 'o'</code></dt>
541 <dd>
542 <p>Javascript string.</p>
543 </dd>
544 <dt class="hdlist1"><code>SIGNATURE 'g'</code></dt>
545 <dd>
546 <p>Javascript string.</p>
547 </dd>
548 <dt class="hdlist1"><code>ARRAY of BYTE 'ay'</code></dt>
549 <dd>
550 <p>A string containing base64 encoded data.</p>
551 </dd>
552 <dt class="hdlist1"><code>ARRAY of DICT_ENTRY with STRING keys 'a{s?}'</code></dt>
553 <dd>
554 <p>A javascript plain object with the keys as property names.</p>
555 </dd>
556 <dt class="hdlist1"><code>ARRAY of DICT_ENTRY with other keys 'a{??}'</code></dt>
557 <dd>
558 <p>A javascript plain object each key JSON encoded into a string property
559 name.</p>
560 </dd>
561 <dt class="hdlist1"><code>ARRAY of other</code></dt>
562 <dd>
563 <p>A javascript array.</p>
564 </dd>
565 <dt class="hdlist1"><code>VARIANT</code></dt>
566 <dd>
567 <p>A javascript plain object with the <code>"t"</code> property set to a DBus type
568 string, and the <code>"v"</code> property set to a value.</p>
569 </dd>
570 <dt class="hdlist1"><code>HANDLE 'h'</code></dt>
571 <dd>
572 <p>A javascript object that describes a cockpit channel which represents
573 the passed file descriptor. The <code>payload</code> is always set to
574 <code>stream</code>. Pass it to
575 <a href="cockpit-channels.html#cockpit-channels-channel">cockpit.channel()</a> to create the
576 channel and start reading or writing on it. Handles can only be
577 received, not sent from within cockpit.</p>
578 </dd>
579 </dl>
580 </div>
581 </div>
582 </div>
583 <div class="sect1">
584 <h2 id="cockpit-dbus-dbus">cockpit.dbus()</h2>
585 <div class="sectionbody">
586 <div class="literalblock">
587 <div class="content">
588 <pre>client = cockpit.dbus(name, [options])</pre>
589 </div>
590 </div>
591 <div class="paragraph">
592 <p>Create a DBus client for the given bus <code>name</code> (eg: service name). Use
593 the following functions to make DBus method calls, watch for events,
594 etc. The optional <code>options</code> argument is a javascript plain object, and
595 may include:</p>
596 </div>
597 <div class="dlist">
598 <dl>
599 <dt class="hdlist1"><code>"bus"</code></dt>
600 <dd>
601 <p>The DBus bus to connect to. Specifying <code>"session"</code> will connect to
602 the DBus user session bus, <code>"user"</code> will connect to the user bus (on
603 some systems this is identical to the session bus), <code>"system"</code> will
604 connect to the DBus system bus, and <code>"none"</code> to the non-standard bus
605 specified with the <code>address</code> option. This defaults to "system" if
606 not present.</p>
607 </dd>
608 <dt class="hdlist1"><code>"address"</code></dt>
609 <dd>
610 <p>The bus address to connect to in case <code>bus</code> is <code>"none"</code>.</p>
611 </dd>
612 <dt class="hdlist1"><code>"superuser"</code></dt>
613 <dd>
614 <p>Set to <code>"require"</code> to talk to this service as root. The DBus service
615 will see the DBus method calls and accesses as coming from root,
616 rather than the logged in user. This is useful for talking to services
617 that do not correctly use
618 <a href="https://www.freedesktop.org/software/polkit">polkit</a> to authorize
619 administrative users. If the currently logged in user is not permitted
620 to become root (eg: via <code>pkexec</code>) then the <code>client</code> will
621 immediately be <a href="#cockpit-dbus-onclose">closed</a> with a
622 <code>"access-denied"</code> problem code.
623 +
624 Set to <code>"try"</code> to try to talk as root, but if that fails, fall back
625 to unprivileged.</p>
626 </dd>
627 <dt class="hdlist1"><code>"track"</code></dt>
628 <dd>
629 <p>It is valid for a DBus service to exit, and be restarted in such a way
630 that clients continue to talk to it across the restart. Some services
631 are not written with this in mind. If the <code>"track"</code> option is set to
632 <code>true</code> then the channel will close when the service exits and/or
633 disconnects from the DBus bus.</p>
634 </dd>
635 </dl>
636 </div>
637 <div class="paragraph">
638 <p>If the <code>name</code> argument is null, and no options other than <code>"bus"</code>
639 are specified, then a shared DBus <code>client</code> is created. When using such
640 a client with a DBus bus, a <code>"name"</code> option must be specified on
641 various other methods in order to specify which client to talk to.</p>
642 </div>
643 </div>
644 </div>
645 <div class="sect1">
646 <h2 id="cockpit-dbus-wait">client.wait()</h2>
647 <div class="sectionbody">
648 <div class="literalblock">
649 <div class="content">
650 <pre>promise = client.wait([callback])</pre>
651 </div>
652 </div>
653 <div class="paragraph">
654 <p>Returns a <code>promise</code> that is ready when the client is ready, or fails
655 if the client closes. If a <code>callback</code> is specified, it is attached to
656 the promise.</p>
657 </div>
658 </div>
659 </div>
660 <div class="sect1">
661 <h2 id="cockpit-dbus-close">client.close()</h2>
662 <div class="sectionbody">
663 <div class="literalblock">
664 <div class="content">
665 <pre>client.close([problem])</pre>
666 </div>
667 </div>
668 <div class="paragraph">
669 <p>Close the DBus client. If <code>problem</code> is specified it should be a
670 <a href="cockpit-error.html#cockpit-problems">problem code</a> string.</p>
671 </div>
672 </div>
673 </div>
674 <div class="sect1">
675 <h2 id="cockpit-dbus-onclose">client.onclose</h2>
676 <div class="sectionbody">
677 <div class="literalblock">
678 <div class="content">
679 <pre>client.addEventListener("close", options =&gt; { ... })</pre>
680 </div>
681 </div>
682 <div class="paragraph">
683 <p>An event triggered when the DBus client closes. This can happen either
684 because <a href="#cockpit-dbus-close">client.close()</a> function was called, or
685 the DBus service went away, or some other problem or disconnection.</p>
686 </div>
687 <div class="paragraph">
688 <p>The <code>options</code> will contain various close information, including a
689 <code>"problem"</code> field which will be set if the channel was closed because
690 of a problem.</p>
691 </div>
692 </div>
693 </div>
694 <div class="sect1">
695 <h2 id="cockpit-dbus-onowned">client.onowner</h2>
696 <div class="sectionbody">
697 <div class="literalblock">
698 <div class="content">
699 <pre>client.addEventListener("owner", (event, owner) =&gt; { ... })</pre>
700 </div>
701 </div>
702 <div class="paragraph">
703 <p>An event triggered when the owner of the DBus name changes. The owner
704 value will be the id of the name owner on the bus or null if the name is
705 unowned. The absence of an owner should not be treated as a
706 disconnection. However this makes it possible to take some action based
707 on the actual status of the service, for example disconnecting a pending
708 signal handler.</p>
709 </div>
710 </div>
711 </div>
712 <div class="sect1">
713 <h2 id="cockpit-dbus-options">client.options</h2>
714 <div class="sectionbody">
715 <div class="paragraph">
716 <p>Set to the options used when creating the client. Will not change for
717 the life of the client.</p>
718 </div>
719 </div>
720 </div>
721 <div class="sect1">
722 <h2 id="cockpit-dbus-unique-name">client.unique_name</h2>
723 <div class="sectionbody">
724 <div class="paragraph">
725 <p>The unique DBus name of the client. Initially null, and becomes valid
726 once the the client is ready.</p>
727 </div>
728 </div>
729 </div>
730 <div class="sect1">
731 <h2 id="cockpit-dbus-proxy">client.proxy()</h2>
732 <div class="sectionbody">
733 <div class="literalblock">
734 <div class="content">
735 <pre>proxy = client.proxy([interface, path], [options])</pre>
736 </div>
737 </div>
738 <div class="paragraph">
739 <p>Create proxy javascript object for a DBus <code>interface</code>. At the
740 specified DBus object <code>path</code>. The proxy will have properties, methods
741 and signals from to the DBus interface, and allows for natural
742 interaction. If no <code>interface</code> is specified then the DBus bus name of
743 the client is used. If no <code>path</code> is specified, then the DBus name of
744 the client is converted to a path.</p>
745 </div>
746 <div class="paragraph">
747 <p>If creating lots of proxies for a given <code>interface</code> it is more
748 efficient to use the <a href="#cockpit-dbus-proxies"><code>client.proxies()</code></a>
749 function.</p>
750 </div>
751 <div class="paragraph">
752 <p>The proxy is loaded when the
753 <a href="#cockpit-dbus-proxy-valid"><code>proxy.valid</code></a> field is <code>true</code>, and
754 it is set to <code>false</code> if the underlying <code>interface</code> and/or <code>path</code>
755 don&#8217;t or no longer exist, or the <code>client</code> has closed. You can wait for
756 proxy to become valid by passing a callback to its
757 <a href="#cockpit-dbus-proxy-wait"><code>proxy.wait()</code></a> function. The
758 <a href="#cockpit-dbus-proxy-onchanged"><code>proxy.onchanged</code></a> event will also
759 fire when the proxy becomes valid or invalid. DBus properties and
760 methods on the proxy are not defined until the proxy becomes valid.</p>
761 </div>
762 <div class="literalblock">
763 <div class="content">
764 <pre>value = proxy.Prop1
765 proxy.WritableProp = value</pre>
766 </div>
767 </div>
768 <div class="paragraph">
769 <p>All DBus properties on the <code>interface</code> that start with an upper case
770 letter (as is convention) will be automatically defined on this proxy,
771 and will update their values as the DBus property values change. In
772 addition the <a href="#cockpit-dbus-proxy-onchanged"><code>proxy.onchanged</code></a>
773 event will fire every time the properties change.</p>
774 </div>
775 <div class="paragraph">
776 <p>If you assign a value to a writable property on the proxy, the proxy
777 will try to set that property on the DBus <code>interface</code> at <code>path</code>. The
778 actual proxy property value will not update until the DBus service has
779 notified the proxy of the change. If setting a property fails a warning
780 will be logged. In order to have more reliable setting of properties, or
781 track when they have been set, or if setting fails, use the
782 <a href="#cockpit-dbus-call"><code>client.call()</code></a> directly. It should be noted
783 that DBus service implementations may also be inconsistent in their
784 behavior when setting a property fails.</p>
785 </div>
786 <div class="paragraph">
787 <p>You can access the raw property data using the
788 <a href="#cockpit-dbus-proxy-data"><code>proxy.data</code></a> field, including data for
789 properties that do not start with an upper case letter.</p>
790 </div>
791 <div class="literalblock">
792 <div class="content">
793 <pre>proxy.Method(arg1, arg2)
794 .then((retval1, retval2) =&gt; {
795 ...
796 })
797 .catch(ex =&gt; {
798 ...
799 });</pre>
800 </div>
801 </div>
802 <div class="paragraph">
803 <p>All DBus methods on the <code>interface</code> that start with an upper case
804 letter (as is convention) will be automatically defined on this proxy.
805 These methods are called with arguments as normal javascript arguments.
806 A
807 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>
808 that will complete successfully when the method returns, or fail if an
809 error occurs. The return values from the DBus method will be passed to
810 the <code>then</code> handler function directly.</p>
811 </div>
812 <div class="paragraph">
813 <p>Methods that do not start with an upper case letter can be invoked by
814 using the usual <a href="#cockpit-dbus-proxy-call"><code>proxy.call()</code></a>
815 directly.</p>
816 </div>
817 <div class="literalblock">
818 <div class="content">
819 <pre>proxy.addEventListener("signal", (event, arg1, arg2) =&gt; {
820 ...
821 });</pre>
822 </div>
823 </div>
824 <div class="paragraph">
825 <p>All DBus signals on the <code>interface</code> that start with an upper case
826 letter (as is convention) will be automatically emit events on this
827 proxy. These events will contain the signal arguments after the standard
828 <code>event</code> argument.</p>
829 </div>
830 <div class="paragraph">
831 <p>Signals that do not start with an upper case letter can be subscribed to
832 by using <a href="#cockpit-dbus-proxy-signal"><code>proxy.onsignal</code></a> directly.</p>
833 </div>
834 <div class="paragraph">
835 <p>Usually a proxy asks the <code>client</code> to watch and notify it of changes to
836 the relevant object or path. You can pass an <code>options</code> argument with
837 the <code>watch</code> field set to <code>false</code> to prevent this.</p>
838 </div>
839 </div>
840 </div>
841 <div class="sect1">
842 <h2 id="cockpit-dbus-proxy-client">proxy.client</h2>
843 <div class="sectionbody">
844 <div class="paragraph">
845 <p>Set to the DBus client of the proxy. Will not change for the life of the
846 proxy.</p>
847 </div>
848 </div>
849 </div>
850 <div class="sect1">
851 <h2 id="cockpit-dbus-proxy-path">proxy.path</h2>
852 <div class="sectionbody">
853 <div class="paragraph">
854 <p>Set to the DBus object path of the proxy. Will not change for the life
855 of the proxy.</p>
856 </div>
857 </div>
858 </div>
859 <div class="sect1">
860 <h2 id="cockpit-dbus-proxy-iface">proxy.iface</h2>
861 <div class="sectionbody">
862 <div class="paragraph">
863 <p>Set to the DBus interface name of the proxy. Will not change for the
864 life of the proxy.</p>
865 </div>
866 </div>
867 </div>
868 <div class="sect1">
869 <h2 id="cockpit-dbus-proxy-valid">proxy.valid</h2>
870 <div class="sectionbody">
871 <div class="paragraph">
872 <p>Set to <code>true</code> when the proxy&#8217;s DBus interface is present at its DBus
873 path, and all information for the proxy has loaded. Is set to <code>false</code>
874 while loading, and after the proxy no longer refers a DBus interface and
875 path. Also set to <code>false</code> if the <code>client</code> closes.</p>
876 </div>
877 <div class="paragraph">
878 <p>Use the by <a href="#cockpit-dbus-proxy-wait"><code>proxy.wait()</code></a> function to
879 wait for a proxy to load. The
880 <a href="#cockpit-dbus-proxy-onchanged"><code>proxy.onchanged</code></a> event will also
881 be emitted when the proxy becomes valid or invalid. DBus properties and
882 methods on the proxy are not defined until the proxy becomes valid.</p>
883 </div>
884 </div>
885 </div>
886 <div class="sect1">
887 <h2 id="cockpit-dbus-proxy-data">proxy.data</h2>
888 <div class="sectionbody">
889 <div class="paragraph">
890 <p>A plain javascript object containing all the raw property data that this
891 proxy has loaded. This will be updated automatically as the proxy is
892 notified of property changes from the DBus service. The
893 <a href="#cockpit-dbus-proxy-onchanged"><code>proxy.onchanged</code></a> event will be
894 emitted when it changes.</p>
895 </div>
896 </div>
897 </div>
898 <div class="sect1">
899 <h2 id="cockpit-dbus-proxy-call">proxy.call()</h2>
900 <div class="sectionbody">
901 <div class="literalblock">
902 <div class="content">
903 <pre>invocation = proxy.call(method, args, [options])</pre>
904 </div>
905 </div>
906 <div class="paragraph">
907 <p>Make a DBus method call on this proxy.</p>
908 </div>
909 <div class="paragraph">
910 <p>For DBus methods that start with an upper case letter, is usually more
911 convenient <a href="#cockpit-dbus-proxy">to call the method directly on the
912 proxy</a>. However if methods that do not follow the usual DBus convention,
913 or specify additional options, or the caller cannot be sure that the
914 method actually exists, you can use this method.</p>
915 </div>
916 <div class="paragraph">
917 <p>This function also works on proxies that have are still loading and have
918 not become valid yet.</p>
919 </div>
920 <div class="paragraph">
921 <p>The <code>method</code> should be a DBus method name, and the <code>args</code> should be
922 an array of arguments to pass to the method. The <code>options</code> are
923 <a href="#cockpit-dbus-call">described elsewhere</a>.</p>
924 </div>
925 <div class="paragraph">
926 <p>The returned value is identical to the one returned from
927 <a href="#cockpit-dbus-call">client.call()</a>. It is a
928 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>
929 that will complete successfully when the method returns, or fail if an
930 error occurs.</p>
931 </div>
932 </div>
933 </div>
934 <div class="sect1">
935 <h2 id="cockpit-dbus-proxy-wait">proxy.wait()</h2>
936 <div class="sectionbody">
937 <div class="literalblock">
938 <div class="content">
939 <pre>promise = proxy.wait()
940 proxy.wait(() =&gt; {
941 ...
942 });</pre>
943 </div>
944 </div>
945 <div class="paragraph">
946 <p>Wait for a proxy to finish loading. This function returns a promise. If
947 a callback function is passed as an argument then that function will be
948 invoked when the proxy is ready. If this method is called after a proxy
949 has already loaded, then the promise will be resolved immediately, and
950 any callback will be invoked immediately. Use the promise or
951 <code>proxy.valid</code> to determine whether the proxy is valid.</p>
952 </div>
953 </div>
954 </div>
955 <div class="sect1">
956 <h2 id="cockpit-dbus-proxy-onchanged">proxy.onchanged</h2>
957 <div class="sectionbody">
958 <div class="literalblock">
959 <div class="content">
960 <pre>proxy.addEventListener("changed", (event, data) =&gt; {
961 ...
962 });</pre>
963 </div>
964 </div>
965 <div class="paragraph">
966 <p>This event is emitted when the proxy&#8217;s properties change.</p>
967 </div>
968 <div class="paragraph">
969 <p>The <code>data</code> has the following form, and will only include properties
970 that have changed:</p>
971 </div>
972 <div class="literalblock">
973 <div class="content">
974 <pre>{
975 "Prop1": "value",
976 "Prop2": 5
977 }</pre>
978 </div>
979 </div>
980 </div>
981 </div>
982 <div class="sect1">
983 <h2 id="cockpit-dbus-proxy-signal">proxy.onsignal</h2>
984 <div class="sectionbody">
985 <div class="literalblock">
986 <div class="content">
987 <pre>proxy.addEventListener("signal", (event, name, args) =&gt; {
988 ...
989 });</pre>
990 </div>
991 </div>
992 <div class="paragraph">
993 <p>This event is emitted when the proxy&#8217;s emits an event.</p>
994 </div>
995 <div class="paragraph">
996 <p>For most events, that have names which start with an upper case letter,
997 you can just <a href="#cockpit-dbus-proxy">connect to that event as a signal
998 directly</a>. However if you wish to be notified when any signal is
999 emitted, or for signals that do not follow the usual DBus convention,
1000 you can connect to this event.</p>
1001 </div>
1002 <div class="paragraph">
1003 <p>The <code>name</code> is the DBus signal name, and the <code>args</code> is an array of
1004 arguments that were emitted with the signal.</p>
1005 </div>
1006 </div>
1007 </div>
1008 <div class="sect1">
1009 <h2 id="cockpit-dbus-proxies">client.proxies()</h2>
1010 <div class="sectionbody">
1011 <div class="literalblock">
1012 <div class="content">
1013 <pre>proxies = client.proxies([interface], [path_namespace], [options])</pre>
1014 </div>
1015 </div>
1016 <div class="paragraph">
1017 <p>Create <a href="#cockpit-dbus-proxy">proxy javascript objects</a> for a DBus
1018 interfaces. The proxies will have properties, methods and signals from
1019 the DBus <code>interface</code>, and allow for natural interaction. If no
1020 <code>interface</code> is specified then the DBus bus name of the client is used.
1021 If no <code>path_namespace</code> is provided then <code>"/"</code> will be used.</p>
1022 </div>
1023 <div class="paragraph">
1024 <p>Proxies will be automatically created for instances of the <code>interface</code>
1025 available at the DBus service. The optional <code>path_namespace</code> argument
1026 can be used to restrict the proxies for instances that have DBus paths
1027 which have the namespace path prefix.</p>
1028 </div>
1029 <div class="literalblock">
1030 <div class="content">
1031 <pre>proxy1 = proxies["/dbus/path1"];
1032 proxy2 = proxies["/dbus/path2"];
1033 for (proxy in proxies) {
1034 ...
1035 }</pre>
1036 </div>
1037 </div>
1038 <div class="paragraph">
1039 <p>The returned <code>proxies</code> object will is used as a dictionary, and will
1040 have values containing proxies for DBus interface instances, with the
1041 keys being the DBus paths of those instances. It is possible to
1042 enumerate over the returned <code>proxies</code>.</p>
1043 </div>
1044 <div class="paragraph">
1045 <p>Proxies will be automatically added and removed from the <code>proxies</code>
1046 object as they appear and disappear in the service. The
1047 <a href="#cockpit-dbus-proxies-onadded"><code>proxies.onadded</code></a> and
1048 <a href="#cockpit-dbus-proxies-onremoved"><code>proxies.onremoved</code></a> events will
1049 be emitted. DBus services may not support notifications of paths
1050 disappearing.</p>
1051 </div>
1052 <div class="paragraph">
1053 <p>Use the <code>proxies.wait()</code> function to be notified when the initial set
1054 of proxies has been populated.</p>
1055 </div>
1056 <div class="paragraph">
1057 <p>Usually a proxies ask the <code>client</code> to watch and be notified of changes
1058 to the relevant object or path. You can pass an <code>options</code> argument
1059 with the <code>watch</code> field set to <code>false</code> to prevent this.</p>
1060 </div>
1061 </div>
1062 </div>
1063 <div class="sect1">
1064 <h2 id="cockpit-dbus-proxies-wait">proxies.wait()</h2>
1065 <div class="sectionbody">
1066 <div class="literalblock">
1067 <div class="content">
1068 <pre>promise = proxies.wait()
1069 proxies.wait(() =&gt; {
1070 ...
1071 });</pre>
1072 </div>
1073 </div>
1074 <div class="paragraph">
1075 <p>Wait for a <code>proxies</code> object to populate its initial set of proxies.
1076 This function returns a promise. If a callback function is passed as an
1077 argument then that function will be invoked when the proxies are ready.
1078 If this method is called after the proxies have populated, then the
1079 promise will be resolved immediately, and any callback will be invoked
1080 immediately.</p>
1081 </div>
1082 </div>
1083 </div>
1084 <div class="sect1">
1085 <h2 id="cockpit-dbus-proxies-client">proxies.client</h2>
1086 <div class="sectionbody">
1087 <div class="paragraph">
1088 <p>Set to the DBus client of the proxies. Will not change.</p>
1089 </div>
1090 </div>
1091 </div>
1092 <div class="sect1">
1093 <h2 id="cockpit-dbus-proxies-iface">proxies.iface</h2>
1094 <div class="sectionbody">
1095 <div class="paragraph">
1096 <p>Set to the DBus interface name of the proxies. Will not change.</p>
1097 </div>
1098 </div>
1099 </div>
1100 <div class="sect1">
1101 <h2 id="cockpit-dbus-proxies-path_namespace">proxies.path_namespace</h2>
1102 <div class="sectionbody">
1103 <div class="paragraph">
1104 <p>Set to the DBus path namespace used which the proxies must have as a
1105 DBus path prefix. Will not change.</p>
1106 </div>
1107 </div>
1108 </div>
1109 <div class="sect1">
1110 <h2 id="cockpit-dbus-proxies-onadded">proxies.onadded</h2>
1111 <div class="sectionbody">
1112 <div class="literalblock">
1113 <div class="content">
1114 <pre>proxies.addEventListener("added", (event, proxy) =&gt; {
1115 ...
1116 })</pre>
1117 </div>
1118 </div>
1119 <div class="paragraph">
1120 <p>This event is emitted when a proxy is added to the <code>proxies</code> object.
1121 The proxy will already have loaded.</p>
1122 </div>
1123 </div>
1124 </div>
1125 <div class="sect1">
1126 <h2 id="cockpit-dbus-proxies-onchanged">proxies.onchanged</h2>
1127 <div class="sectionbody">
1128 <div class="literalblock">
1129 <div class="content">
1130 <pre>proxies.addEventListener("changed", (event, proxy) =&gt; {
1131 ...
1132 })</pre>
1133 </div>
1134 </div>
1135 <div class="paragraph">
1136 <p>This event is emitted when one of the proxy in the <code>proxies</code> object
1137 changes its properties.</p>
1138 </div>
1139 </div>
1140 </div>
1141 <div class="sect1">
1142 <h2 id="cockpit-dbus-proxies-onremoved">proxies.onremoved</h2>
1143 <div class="sectionbody">
1144 <div class="literalblock">
1145 <div class="content">
1146 <pre>proxies.addEventListener("removed", (event, proxy) =&gt; {
1147 ...
1148 })</pre>
1149 </div>
1150 </div>
1151 <div class="paragraph">
1152 <p>This event is emitted when a proxy is removed to the <code>proxies</code> object.</p>
1153 </div>
1154 </div>
1155 </div>
1156 <div class="sect1">
1157 <h2 id="cockpit-dbus-call">client.call()</h2>
1158 <div class="sectionbody">
1159 <div class="literalblock">
1160 <div class="content">
1161 <pre>invocation = client.call(path, interface, method, args, [options])</pre>
1162 </div>
1163 </div>
1164 <div class="paragraph">
1165 <p>Make a DBus method call.</p>
1166 </div>
1167 <div class="paragraph">
1168 <p>The <code>path</code> is the DBus object path to make the call on, <code>interface</code>
1169 is the DBus interface for the method and <code>method</code> is the name of the
1170 method to call. The <code>args</code> is an array of arguments to pass to the
1171 method, each of which must be appropriate for the expected
1172 <a href="#cockpit-dbus">DBus type</a> of that argument. The <code>args</code> may be
1173 <code>null</code> if no arguments are to be sent.</p>
1174 </div>
1175 <div class="paragraph">
1176 <p>The returned value is a
1177 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>
1178 that will complete successfully when the method returns, or fail if an
1179 error occurs.</p>
1180 </div>
1181 <div class="paragraph">
1182 <p>If <code>options</code> is specified it should be a plain javascript object,
1183 which may contain the following properties:</p>
1184 </div>
1185 <div class="dlist">
1186 <dl>
1187 <dt class="hdlist1"><code>flags</code></dt>
1188 <dd>
1189 <p>A string containing DBus message flags. The character <code>"i"</code>
1190 indicates to the dbus service that interactive authentication is
1191 allowed. If the entire <code>flags</code> field is missing, then <code>"i"</code> is set
1192 by default.</p>
1193 </dd>
1194 <dt class="hdlist1"><code>type</code></dt>
1195 <dd>
1196 <p>A valid DBus type signature to use when calling the method. In the
1197 absence of this, the DBus service will be introspected (and the result
1198 cached) to ask what the method type signature is.</p>
1199 </dd>
1200 <dt class="hdlist1"><code>timeout</code></dt>
1201 <dd>
1202 <p>The timeout of the call in milliseconds. The call will fail with the
1203 <code>"timeout"</code> problem code. If "timeout" is not given, the call will
1204 never time out.</p>
1205 </dd>
1206 </dl>
1207 </div>
1208 </div>
1209 </div>
1210 <div class="sect1">
1211 <h2 id="cockpit-dbus-then">invocation.then()</h2>
1212 <div class="sectionbody">
1213 <div class="literalblock">
1214 <div class="content">
1215 <pre>invocation.then((args, options) =&gt; { ... })</pre>
1216 </div>
1217 </div>
1218 <div class="paragraph">
1219 <p>This is a standard
1220 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>
1221 method. It sets up a handler to be called when the DBus method call
1222 finishes successfully.</p>
1223 </div>
1224 <div class="paragraph">
1225 <p>The <code>args</code> argument is an array of return values from the DBus method.
1226 Each of them will be converted to an appropriate
1227 <a href="#cockpit-dbus">javascript type</a>.</p>
1228 </div>
1229 <div class="paragraph">
1230 <p>The <code>options</code> argument may contain additional information about the
1231 reply. If the <code>type</code> option was specified when performing the method
1232 call, then the <code>options</code> in the reply here will also contain a
1233 <code>type</code> field containing the DBus type signature of the output. If the
1234 <code>flags</code> option was specified when performing the call then the
1235 <code>options</code> in the reply here will contain message flags. Possible out
1236 message flags are:</p>
1237 </div>
1238 <div class="dlist">
1239 <dl>
1240 <dt class="hdlist1"><code>&gt;</code></dt>
1241 <dd>
1242 <p>A big endian message.</p>
1243 </dd>
1244 <dt class="hdlist1"><code>&lt;</code></dt>
1245 <dd>
1246 <p>A little endian message.</p>
1247 </dd>
1248 </dl>
1249 </div>
1250 </div>
1251 </div>
1252 <div class="sect1">
1253 <h2 id="cockpit-dbus-catch">invocation.catch()</h2>
1254 <div class="sectionbody">
1255 <div class="literalblock">
1256 <div class="content">
1257 <pre>invocation.catch(exception =&gt; { ... })</pre>
1258 </div>
1259 </div>
1260 <div class="paragraph">
1261 <p>This is a standard
1262 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>
1263 method. It sets up a handler to be called when the DBus method call
1264 fails.</p>
1265 </div>
1266 <div class="paragraph">
1267 <p>The <code>exception</code> object passed to the handler can have the following
1268 properties:</p>
1269 </div>
1270 <div class="dlist">
1271 <dl>
1272 <dt class="hdlist1"><code>problem</code></dt>
1273 <dd>
1274 <p>A <a href="cockpit-error.html#cockpit-problems">problem code</a> string when a problem occurred
1275 starting or communicating with the DBus service. This is <code>null</code> in
1276 the cases where an actual DBus error was occurred.</p>
1277 </dd>
1278 <dt class="hdlist1"><code>name</code></dt>
1279 <dd>
1280 <p>The DBus error name. This will be <code>null</code> in cases where the failure
1281 was not due to a DBus error.</p>
1282 </dd>
1283 <dt class="hdlist1"><code>message</code></dt>
1284 <dd>
1285 <p>A DBus error message. This will be <code>null</code> in cases where the failure
1286 was not due to a DBus error.</p>
1287 </dd>
1288 </dl>
1289 </div>
1290 </div>
1291 </div>
1292 <div class="sect1">
1293 <h2 id="cockpit-dbus-subscribe">client.subscribe()</h2>
1294 <div class="sectionbody">
1295 <div class="literalblock">
1296 <div class="content">
1297 <pre>subscription = client.subscribe(match, (path, interface, signal, args) =&gt; { ... })</pre>
1298 </div>
1299 </div>
1300 <div class="paragraph">
1301 <p>Subscribe to signals. The <code>match</code> argument is a javascript plain
1302 object which defines what signals to subscribe to. Each property in the
1303 <code>match</code> argument restricts signals subscribed to. If a property is not
1304 present then it is treated as a wildcard, matching anything. If an empty
1305 object is specified as <code>match</code> then all signals will be subscribed to.
1306 The <code>match</code> argument may contain the following properties:</p>
1307 </div>
1308 <div class="dlist">
1309 <dl>
1310 <dt class="hdlist1"><code>interface</code></dt>
1311 <dd>
1312 <p>A DBus interface to match.</p>
1313 </dd>
1314 <dt class="hdlist1"><code>path</code></dt>
1315 <dd>
1316 <p>A DBus object path to match. May not be used together with the
1317 <code>path_namespace</code> property. It should be a valid DBus object path,
1318 that is, it should have no trailing slash.</p>
1319 </dd>
1320 <dt class="hdlist1"><code>path_namespace</code></dt>
1321 <dd>
1322 <p>A DBus object path prefix to match. Any paths in the hierarchy below
1323 this top path will match. May not be used together with the <code>path</code>
1324 property.</p>
1325 </dd>
1326 <dt class="hdlist1"><code>member</code></dt>
1327 <dd>
1328 <p>The DBus signal name to match.</p>
1329 </dd>
1330 <dt class="hdlist1"><code>arg0</code></dt>
1331 <dd>
1332 <p>Matches the first argument of a DBus message, which must be a string.</p>
1333 </dd>
1334 </dl>
1335 </div>
1336 <div class="paragraph">
1337 <p>The handler passed as the second argument will be invoked when the
1338 signal is received. A <code>subscription</code> is returned which can be used to
1339 remove the subscription by calling its <code>subscription.remove()</code> method.</p>
1340 </div>
1341 <div class="paragraph">
1342 <p>It is not a problem to subscribe to the same signals more than once,
1343 with identical or slightly different <code>match</code> arguments.</p>
1344 </div>
1345 </div>
1346 </div>
1347 <div class="sect1">
1348 <h2 id="cockpit-dbus-remove">subscription.remove()</h2>
1349 <div class="sectionbody">
1350 <div class="literalblock">
1351 <div class="content">
1352 <pre>subscription.remove()</pre>
1353 </div>
1354 </div>
1355 <div class="paragraph">
1356 <p>Unsubscribe from the DBus signal subscription.</p>
1357 </div>
1358 </div>
1359 </div>
1360 <div class="sect1">
1361 <h2 id="cockpit-dbus-watch">client.watch()</h2>
1362 <div class="sectionbody">
1363 <div class="literalblock">
1364 <div class="content">
1365 <pre>watch = client.watch(path)
1366 watch = client.watch({ "path_namespace": path_namespace, "interface": interface })</pre>
1367 </div>
1368 </div>
1369 <div class="paragraph">
1370 <p>Watch for property and interface changes on the given DBus object
1371 <code>path</code> DBus <code>path_namespace</code>. If <code>interface</code> is specified only
1372 properties on that DBus interface will be watched.</p>
1373 </div>
1374 <div class="paragraph">
1375 <p>The <a href="#cockpit-dbus-proxy"><code>client.proxy()</code></a> and
1376 <a href="#cockpit-dbus-proxies"><code>client.proxies()</code></a> functions and the
1377 objects they return are high level wrappers around <code>client.watch()</code>.</p>
1378 </div>
1379 <div class="paragraph">
1380 <p>The property and interface changes will be available in raw form on the
1381 <a href="#cockpit-dbus-onnotify"><code>client.onnotify</code></a> event.</p>
1382 </div>
1383 <div class="paragraph">
1384 <p>Property and interface changes that are caused by a method call or
1385 signal will show up before that method call reply is received, or signal
1386 event is triggered. It should be possible to rely on this guarantee,
1387 unless the DBus service in question behaves incorrectly. Internally
1388 these watches work well with code that implements the
1389 <a href="https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager">ObjectManager</a>
1390 portion of the DBus specification. If no ObjectManager implementation is
1391 available, the watch falls back to using DBus
1392 <a href="https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-introspectable">Introspection</a>
1393 along with the usual
1394 <a href="https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties">PropertiesChanged</a>
1395 signal. If the DBus service implements none of these, or implements them
1396 in an inconsistent manner, then this function will provide inconsistent
1397 or unexpected results.</p>
1398 </div>
1399 <div class="paragraph">
1400 <p>The parameter is either a DBus <code>path</code> or a plain javascript object
1401 with zero or more of the following fields. If an empty javascript object
1402 is used as an argument, then all paths, interfaces and properties will
1403 be watched.</p>
1404 </div>
1405 <div class="dlist">
1406 <dl>
1407 <dt class="hdlist1"><code>interface</code></dt>
1408 <dd>
1409 <p>Watch properties on this DBus interface.</p>
1410 </dd>
1411 <dt class="hdlist1"><code>path</code></dt>
1412 <dd>
1413 <p>Watch interfaces and properties at this DBus path. May not be used
1414 together with the <code>path_namespace</code> property.</p>
1415 </dd>
1416 <dt class="hdlist1"><code>path_namespace</code></dt>
1417 <dd>
1418 <p>Watch interfaces and properties under this DBus path. It should be a
1419 valid DBus object path, that is, it should have no trailing slash. If
1420 an ObjectManager implementation is available at this interface, then
1421 it is used. May not be used together with the <code>path</code> property.</p>
1422 </dd>
1423 </dl>
1424 </div>
1425 <div class="paragraph">
1426 <p>The returned value is a
1427 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>
1428 that will complete successfully when the watch has populated its initial
1429 set of properties and interfaces, and these have been notified via
1430 <a href="#cockpit-dbus-onnotify"><code>client.onnotify</code></a>.</p>
1431 </div>
1432 <div class="paragraph">
1433 <p>A watch can be removed by calling the
1434 <a href="#cockpit-dbus-watch-remove"><code>watch.remove()</code></a> method on the
1435 returned value. If identical watches are added more than once, then they
1436 must also be removed the same number of times before the removal takes
1437 effect.</p>
1438 </div>
1439 </div>
1440 </div>
1441 <div class="sect1">
1442 <h2 id="cockpit-dbus-watch-then">watch.then()</h2>
1443 <div class="sectionbody">
1444 <div class="literalblock">
1445 <div class="content">
1446 <pre>watch.then(() =&gt; { ... })</pre>
1447 </div>
1448 </div>
1449 <div class="paragraph">
1450 <p>This is a standard
1451 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>
1452 method. It sets up a handler to be called when the watch has populated
1453 its initial properties and interfaces.</p>
1454 </div>
1455 </div>
1456 </div>
1457 <div class="sect1">
1458 <h2 id="cockpit-dbus-watch-catch">watch.catch()</h2>
1459 <div class="sectionbody">
1460 <div class="literalblock">
1461 <div class="content">
1462 <pre>watch.catch(ex =&gt; { ... })</pre>
1463 </div>
1464 </div>
1465 <div class="paragraph">
1466 <p>This is a standard
1467 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>
1468 method. It sets up a handler to be called if the watch fails to populate
1469 its initial properties and interfaces. Note that a watch will only fail
1470 if the DBus client closes or is somehow disconnected. It does not fail
1471 in the case of missing interfaces or properties.</p>
1472 </div>
1473 </div>
1474 </div>
1475 <div class="sect1">
1476 <h2 id="cockpit-dbus-watch-remove">watch.remove()</h2>
1477 <div class="sectionbody">
1478 <div class="literalblock">
1479 <div class="content">
1480 <pre>watch.remove()</pre>
1481 </div>
1482 </div>
1483 <div class="paragraph">
1484 <p>Remove the watch. This may not have any immediate effect if other
1485 watches are in place. In particular, if identical watches are added more
1486 than once, then they must also be removed the same number of times
1487 before the removal takes effect.</p>
1488 </div>
1489 </div>
1490 </div>
1491 <div class="sect1">
1492 <h2 id="cockpit-dbus-onnotify">client.onnotify</h2>
1493 <div class="sectionbody">
1494 <div class="literalblock">
1495 <div class="content">
1496 <pre>client.addEventListener("notify", data =&gt; { ... })</pre>
1497 </div>
1498 </div>
1499 <div class="paragraph">
1500 <p>An event triggered when <a href="#cockpit-dbus-watch">watched</a> properties or
1501 interfaces change.</p>
1502 </div>
1503 <div class="paragraph">
1504 <p>The <a href="#cockpit-dbus-proxy"><code>client.proxy()</code></a> and
1505 <a href="#cockpit-dbus-proxies"><code>client.proxies()</code></a> functions and the
1506 objects they return are high level wrappers around the <code>data</code> provided
1507 by this event.</p>
1508 </div>
1509 <div class="paragraph">
1510 <p>The <code>data</code> has the following form:</p>
1511 </div>
1512 <div class="literalblock">
1513 <div class="content">
1514 <pre>{
1515 "/path1": {
1516 "org.Interface1": {
1517 "Prop1": "value",
1518 "Prop2": 5
1519 },
1520 "org.Interface2": null
1521 }
1522 }</pre>
1523 </div>
1524 </div>
1525 <div class="paragraph">
1526 <p>Multiple paths may be present, each of which may have multiple
1527 interfaces, each of which may have multiple properties. The first time a
1528 given path and interface is emitted from this signal, it will have all
1529 its properties and interfaces. Thereafter only changes are noted. If an
1530 interface is set to <code>null</code>, then that interface has disappeared.</p>
1531 </div>
1532 </div>
1533 </div>
1534 <div class="sect1">
1535 <h2 id="cockpit-dbus-notify">client.notify()</h2>
1536 <div class="sectionbody">
1537 <div class="literalblock">
1538 <div class="content">
1539 <pre>client.notify(data)</pre>
1540 </div>
1541 </div>
1542 <div class="paragraph">
1543 <p>Emits a synthetic <a href="#cockpit-dbus-onnotify"><code>notify</code></a> event. The
1544 <code>data</code> argument should follow the same layout as described for the
1545 <code>notify</code> event.</p>
1546 </div>
1547 </div>
1548 </div>
1549 <div class="sect1">
1550 <h2 id="cockpit-dbus-onmeta">client.onmeta</h2>
1551 <div class="sectionbody">
1552 <div class="literalblock">
1553 <div class="content">
1554 <pre>client.onmeta = (ev, data) =&gt; { ... }</pre>
1555 </div>
1556 </div>
1557 <div class="paragraph">
1558 <p>An event triggered when the meta data about
1559 <a href="#cockpit-dbus-watch">watched</a> interfaces is loaded.</p>
1560 </div>
1561 <div class="paragraph">
1562 <p>The <a href="#cockpit-dbus-proxy"><code>client.proxy()</code></a> and
1563 <a href="#cockpit-dbus-proxies"><code>client.proxies()</code></a> functions and the
1564 objects they return are high level wrappers around the <code>data</code> provided
1565 by this event.</p>
1566 </div>
1567 <div class="paragraph">
1568 <p>The <code>data</code> has the following form:</p>
1569 </div>
1570 <div class="literalblock">
1571 <div class="content">
1572 <pre> {
1573 "org.Interface": {
1574 "methods": {
1575 "Method1": {
1576 "in": [ "s", "v" ],
1577 "out": [ "i" ]
1578 },
1579 "Method2": { }
1580 },
1581 "signals": {
1582 "Signal": {
1583 "in": [ "b", "s" ]
1584 }
1585 },
1586 "properties": {
1587 "Prop1": {
1588 "flags": "rw",
1589 "type": "s"
1590 },
1591 "Prop2": {
1592 "flags": "r",
1593 "type": "b"
1594 }
1595 }
1596 }
1597 }</pre>
1598 </div>
1599 </div>
1600 <div class="paragraph">
1601 <p>Multiple interfaces may be present, each of which may have methods and
1602 properties. This is emitted before the first
1603 <a href="#cockpit-dbus-proxy"><code>client.onnotify</code></a> event for the relevant
1604 interface.</p>
1605 </div>
1606 </div>
1607 </div>
1608 <div class="sect1">
1609 <h2 id="cockpit-dbus-variant">cockpit.variant()</h2>
1610 <div class="sectionbody">
1611 <div class="literalblock">
1612 <div class="content">
1613 <pre>variant = cockpit.variant(type, value)</pre>
1614 </div>
1615 </div>
1616 <div class="paragraph">
1617 <p>A DBus variant is represented as a plain javascript object with a
1618 <code>"t"</code> property represesting the full DBus type of the variant, and a
1619 <code>"v"</code> property containing the variant value.</p>
1620 </div>
1621 <div class="paragraph">
1622 <p>This is a helper function for creating such a variant object.</p>
1623 </div>
1624 </div>
1625 </div>
1626 </div>
1627 <div id="footer">
1628 <div id="footer-text">
1629 Last updated 2026-09-23 13:50:34 UTC
1630 </div>
1631 </div>
1632 </body>
1633 </html>