[#IDEA-146] Describe milestone 2

This commit is contained in:
Adrià Cidre 2018-04-13 12:35:46 +02:00
parent cb02aa0f63
commit c15f3be0e3
No known key found for this signature in database
GPG Key ID: D246A27D58A92CAB
4 changed files with 86 additions and 6 deletions

View File

@ -1,6 +1,6 @@
## Milestone 1: Basic SDK
## Milestone 1: Status messaging basic interaction
// TODO its still not clear how username works on the new protocol, it may change the methods using it, as it's not used atm.
** * TODO its still not clear how username works on the new protocol, it may change the methods using it, as it's not used atm. **
### Setup a new connection
@ -46,7 +46,7 @@ if err := conn.SignupOrLogin("username", "password"); err != nil {
`SignupOrLogin` method is provided so you can sign up as a specific user
```
if err := conn.Login("username", "password"); err != nil {
if err := conn.SignupOrLogin("username", "password"); err != nil {
panic(err)
}
```
@ -54,7 +54,15 @@ if err := conn.Login("username", "password"); err != nil {
### Ability to login as a specific account
`Login` method provides an interface to log in
```
if err := conn.Login("username", "password"); err != nil {
panic(err)
}
```
### Documented API for basic sdk interaction
### Ability to log out.
This document can be adapted as a documentation for basic sdk interaction

View File

@ -0,0 +1,50 @@
## Milestone 2: Public channels interaction
Public channels interaction is about how the developer will be interacting with public channels.
### Ability to join public channels
A new public channel will be joined using Join method:
```
ch, err := conn.Join("my_channel")
if err != nil {
panic("Couldn't join my_channel")
}
```
### Ability to publish messages on public channels
You can use the Channel object to publish messages on it as follows:
```
ch, _ := conn.Join("my_channel")
ch.Publish("Hello world")
```
### Ability to subscribe to public channels
Subscribing a channel means a script will be able to listen to any messages on a specific public channel. This can be achieved with Channel Subscribe method as follows:
```
ch, _ := conn.Join("my_channel")
ch.Subscribe(func(m *sdk.Msg) {
log.Println("Message from ", m.From, " with body: ", m.Text)
}
```
### Ability to unsubscribe from a public channel
In order to unsubscribe from a specific public channel you just have to call Unsubscribe method.
```
ch, _ := conn.Join("my_channel")
ch.Subscribe(func(m *sdk.Msg) {
if m.Text == "BYE!" {
ch.Unsubscribe()
}
}
```
### Documented API for public channels interaction.
This document can be adapted as a documentation for public channels interaction
### Working examples for public channel interaction.
Actually [here](https://github.com/status-im/status-go/blob/sdk/sdk/examples/) you'll find an example of a "ping pong game".

View File

@ -90,6 +90,7 @@ Description: <!-- Description of Deliverables-->
- [Pre-existing issue](https://github.com/status-im/ideas/issues/131)
- [New protocol spec](https://docs.google.com/document/d/1Qh2h07T_qepzEJ7IytmxwIdQAOsGHrvhXwZxuZtbwgc/edit#)
- [transit-format](https://github.com/cognitect/transit-format)
- [Sniffing app messages](howto_Sniffing_app_messages.md)
### Blockers
@ -104,14 +105,14 @@ Testing Days required: TBD
## Success Metrics
#### [Milestone 1: Status messaging basic interaction](Milestone1_BasicSDK.md)
#### Milestone 1: [Status messaging basic interaction](Milestone1_BasicSDK.md)
- [ ] Setup a new connection
- [ ] Ability to close a specific connection
- [ ] Ability to change connection configuration
- [ ] Ability to sign up on the platform
- [ ] Ability to login as a specific account
#### Milestone 2: Public channels interaction
#### Milestone 2: [Public channels interaction](Mileston2_PublicChannels.md)
- [ ] Ability to join public channels
- [ ] Ability to publish messages on public channels
- [ ] Ability to subscribe to public channels

View File

@ -0,0 +1,21 @@
## HOWTO : Sniffing app messages
So one of the main points of this swarm is to interact with status app, to do that, we need to speak its same language.
To do that the easiest way is to sniff messages sent by the app, to do this you can:
1.- Clone status-react
2.- Add a log line on [StatusModule.java::sendWeb3Request method](https://github.com/status-im/status-react/blob/develop/modules/react-native-status/android/src/main/java/im/status/ethereum/module/StatusModule.java#L690) printing the payload like:
```
Thread thread = new Thread() {
@Override
public void run() {
+ Log.d("PAYLOAD", "PAYLOAD : " + payload);
+
String res = Statusgo.CallRPC(payload);
callback.invoke(res);
}
```
3.- [Deploy it to your devide/emulator](https://wiki.status.im/Building_Status)
4.- Connect to your emulator and check the logs `adb logcat|grep "PAYLOAD"`