Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚚 #1

Open
dohard-ma opened this issue May 29, 2019 · 5 comments
Open

🚚 #1

dohard-ma opened this issue May 29, 2019 · 5 comments

Comments

@dohard-ma
Copy link

No description provided.

@Xiapeixu
Copy link
Owner

MQTT.createClient({
	automaticReconnect: true,
	uri: 'mqtt://172.16.12.2:1883',
	clientId: 'your_client_id'
}).then(async (client) => {
	// console.log('11111111111', client.disconnect());
	fd.global.mqtt = client;
	client.on('closed', (msg) => {
		console.log('mqtt.event.closed', msg);
	});

	client.on('error', (msg) => {
		console.log('mqtt.event.error', msg);
	});

	client.on('message', (msg) => {
		console.log('message11111', msg);
	});
	client.on('message', (msg) => {
		console.log('message22222', msg);
	});

	client.on('connect', (msg) => {
		console.log('连接', msg);
		client.subscribe('xxx', 0);
		// client.publish('/data', "test", 0, false);
		// client.disconnect();
	});
	client.connect();
	console.log(await client.isConnected(), '22222222');
}).catch((err) => {
	console.log(err);
});
console.log('clients', MQTT);

@Xiapeixu
Copy link
Owner

import { IFeidaoAiMobile } from '@dfeidao/atom-mobile/interfaces';
// import push from '@dfeidao/atom-mobile/push/push';
// import JPushModule from 'jpush-react-native';

export default async function a002(fd: IFeidaoAiMobile) {
const mqtt = fd.global.mqtt;
mqtt.publish('xxx', "test", 0, false);
}

@Xiapeixu
Copy link
Owner

import React, { BaseSyntheticEvent } from 'react';
import { View } from 'react-native';
import { Button } from 'react-native-elements';

export default function tpl(a: (action: string, ...args: unknown[]) => ((ev: BaseSyntheticEvent) => void), s: (...class_names: string[]) => {}, d: (d: string) => string | unknown[]) {
return (
<Button title='发送' onPress={a('a002')}>
);
}

@Xiapeixu
Copy link
Owner

@Xiapeixu
Copy link
Owner

3e669abf4c930cbb08d010c0

Repository owner deleted a comment from dohard-ma May 30, 2019
Repository owner deleted a comment from dohard-ma May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants