You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "konpekicode (Jira)" <ji...@apache.org> on 2022/03/07 09:33:00 UTC
[jira] [Updated] (THRIFT-5535) Ability to support connection on OpenHarmonyOS
[ https://issues.apache.org/jira/browse/THRIFT-5535?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
konpekicode updated THRIFT-5535:
--------------------------------
Description:
Currently thrift can be run on Node.js. Hope it can also support creating TCP connection on OpenHarmonyOS.
For example, we can get data from a web server as follows:
{code:java}
const connection = thrift.createOhosConnection(http.createHttp, host, 80, {
protocol: TJSONProtocol,
header: {
'Content-Type': 'application/json'
},
createHttp: http.createHttp
}),
client = thrift.createOhosClient(TAccountService, connection);
const account = {
uid: 1,
name: 'hello'
}
console.info('requesting...')
client.createAccount(account).then(() => {
console.info('client createAccount:', account.uid);
client.getAccount(account.uid).then((resp) => {
console.info(`client getAccount: uid=${resp.uid}, name=${resp.name}`);
this.user = resp
}).catch(e => {
console.info(e)
})
}).catch(e => {
console.info(e)
}) {code}
[Here|https://github.com/konpeki622/openHarmony-thrift-demo] is the demo. You can run it on [DevEco Studio|[https://developer.harmonyos.com/en/develop/deveco-studio/|https://developer.harmonyos.com/en/develop/deveco-studio/],]], and the result after pressing button will be like the screenshot in README.
For more information about OpenHarmonyOS see this [site|https://developer.harmonyos.com/en/].
was:
Hope it can support creating TCP connection on HarmonyOS.
About HarmonyOS see this [documentation|https://www.harmonyos.com/en/].
Summary: Ability to support connection on OpenHarmonyOS (was: Ability to support connection on HarmonyOS)
> Ability to support connection on OpenHarmonyOS
> ----------------------------------------------
>
> Key: THRIFT-5535
> URL: https://issues.apache.org/jira/browse/THRIFT-5535
> Project: Thrift
> Issue Type: Improvement
> Components: Node.js - Library
> Affects Versions: 0.17.0
> Environment: HarmonyOS devices
> Reporter: konpekicode
> Assignee: Jens Geyer
> Priority: Minor
>
> Currently thrift can be run on Node.js. Hope it can also support creating TCP connection on OpenHarmonyOS.
> For example, we can get data from a web server as follows:
>
> {code:java}
> const connection = thrift.createOhosConnection(http.createHttp, host, 80, {
> protocol: TJSONProtocol,
> header: {
> 'Content-Type': 'application/json'
> },
> createHttp: http.createHttp
> }),
> client = thrift.createOhosClient(TAccountService, connection);
> const account = {
> uid: 1,
> name: 'hello'
> }
> console.info('requesting...')
> client.createAccount(account).then(() => {
> console.info('client createAccount:', account.uid);
> client.getAccount(account.uid).then((resp) => {
> console.info(`client getAccount: uid=${resp.uid}, name=${resp.name}`);
> this.user = resp
> }).catch(e => {
> console.info(e)
> })
> }).catch(e => {
> console.info(e)
> }) {code}
>
>
> [Here|https://github.com/konpeki622/openHarmony-thrift-demo] is the demo. You can run it on [DevEco Studio|[https://developer.harmonyos.com/en/develop/deveco-studio/|https://developer.harmonyos.com/en/develop/deveco-studio/],]], and the result after pressing button will be like the screenshot in README.
> For more information about OpenHarmonyOS see this [site|https://developer.harmonyos.com/en/].
--
This message was sent by Atlassian Jira
(v8.20.1#820001)