1"use strict";(self.webpackChunkplaywright_dev=self.webpackChunkplaywright_dev||[]).push([["1686"],{40843(e,s,n){n.r(s),n.d(s,{metadata:()=>i,default:()=>h,frontMatter:()=>t,contentTitle:()=>o,toc:()=>c,assets:()=>a});var i=JSON.parse('{"id":"api/class-androidsocket","title":"AndroidSocket","description":"AndroidSocket] is a way to communicate with a process launched on the [AndroidDevice]. Use [androidDevice.open() to open a socket.","source":"@site/versioned_docs/version-stable/api/class-androidsocket.mdx","sourceDirName":"api","slug":"/api/class-androidsocket","permalink":"/docs/api/class-androidsocket","draft":false,"unlisted":false,"tags":[],"version":"stable","frontMatter":{"id":"class-androidsocket","title":"AndroidSocket"},"sidebar":"api","previous":{"title":"AndroidInput","permalink":"/docs/api/class-androidinput"},"next":{"title":"AndroidWebView","permalink":"/docs/api/class-androidwebview"}}'),d=n(74848),r=n(28453);n(13554),n(41647),n(83137);let t={id:"class-androidsocket",title:"AndroidSocket"},o,a={},c=[{value:"Methods",id:"methods",level:2},{value:"close",id:"android-socket-close",level:3},{value:"write",id:"android-socket-write",level:3},{value:"Events",id:"events",level:2},{value:"on('close')",id:"android-socket-event-close",level:3},{value:"on('data')",id:"android-socket-event-data",level:3}];function l(e){let s={a:"a",code:"code",h2:"h2",h3:"h3",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(s.p,{children:[(0,d.jsx)(s.a,{href:"/docs/api/class-androidsocket",title:"AndroidSocket",children:"AndroidSocket"})," is a way to communicate with a process launched on the ",(0,d.jsx)(s.a,{href:"/docs/api/class-androiddevice",title:"AndroidDevice",children:"AndroidDevice"}),". Use ",(0,d.jsx)(s.a,{href:"/docs/api/class-androiddevice#android-device-open",children:"androidDevice.open()"})," to open a socket."]}),"\n",(0,d.jsx)(s.hr,{}),"\n",(0,d.jsx)(s.h2,{id:"methods",children:"Methods"}),"\n",(0,d.jsx)(s.h3,{id:"android-socket-close",children:"close"}),"\n",(0,d.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added in: v1.9"}),"\n",(0,d.jsx)("x-search",{children:"androidSocket.close"}),"\n",(0,d.jsx)(s.p,{children:"Closes the socket."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Usage"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-js",children:"await androidSocket.close();\n"})}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"}),"<",(0,d.jsx)(s.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined",title:"void",children:"void"}),">",(0,d.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"android-socket-close-return"}),(0,d.jsx)("a",{href:"#android-socket-close-return",class:"list-anchor",children:"#"})]}),"\n"]}),"\n",(0,d.jsx)(s.hr,{}),"\n",(0,d.jsx)(s.h3,{id:"android-socket-write",children:"write"}),"\n",(0,d.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added in: v1.9"}),"\n",(0,d.jsx)("x-search",{children:"androidSocket.write"}),"\n",(0,d.jsxs)(s.p,{children:["Writes some ",(0,d.jsx)(s.a,{href:"/docs/api/class-androidsocket#android-socket-write-option-data",children:"data"})," to the socket."]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Usage"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-js",children:"await androidSocket.write(data);\n"})}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Arguments"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:["\n",(0,d.jsxs)(s.p,{children:[(0,d.jsx)(s.code,{children:"data"})," ",(0,d.jsx)(s.a,{href:"https://nodejs.org/api/buffer.html#buffer_class_buffer",title:"Buffer",children:"Buffer"}),(0,d.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"android-socket-write-option-data"}),(0,d.jsx)("a",{href:"#android-socket-write-option-data",class:"list-anchor",children:"#"})]}),"\n",(0,d.jsx)(s.p,{children:"Data to write."}),"\n"]}),"\n"]}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Returns"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise",title:"Promise",children:"Promise"}),"<",(0,d.jsx)(s.a,{href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined",title:"void",children:"void"}),">",(0,d.jsx)("a",{"aria-hidden":"true",tabIndex:"-1",class:"list-anchor-link",id:"android-socket-write-return"}),(0,d.jsx)("a",{href:"#android-socket-write-return",class:"list-anchor",children:"#"})]}),"\n"]}),"\n",(0,d.jsx)(s.hr,{}),"\n",(0,d.jsx)(s.h2,{id:"events",children:"Events"}),"\n",(0,d.jsx)(s.h3,{id:"android-socket-event-close",children:"on('close')"}),"\n",(0,d.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added in: v1.9"}),"\n",(0,d.jsx)("x-search",{children:"androidSocket.on('close')"}),"\n",(0,d.jsx)(s.p,{children:"Emitted when the socket is closed."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Usage"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-js",children:"androidSocket.on('close', data => {});\n"})}),"\n",(0,d.jsx)(s.hr,{}),"\n",(0,d.jsx)(s.h3,{id:"android-socket-event-data",children:"on('data')"}),"\n",(0,d.jsx)("font",{size:"2",style:{position:"relative",top:"-20px"},children:"Added in: v1.9"}),"\n",(0,d.jsx)("x-search",{children:"androidSocket.on('data')"}),"\n",(0,d.jsx)(s.p,{children:"Emitted when data is available to read from the socket."}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Usage"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-js",children:"androidSocket.on('data', data => {});\n"})}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Event data"})}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsx)(s.li,{children:(0,d.jsx)(s.a,{href:"https://nodejs.org/api/buffer.html#buffer_class_buffer",title:"Buffer",children:"Buffer"})}),"\n"]})]})}function h(e={}){let{wrapper:s}={...(0,r.R)(),...e.components};return s?(0,d.jsx)(s,{...e,children:(0,d.jsx)(l,{...e})}):l(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.