change appId

This commit is contained in:
DieMyst 2019-08-19 11:24:39 +03:00
parent 505b24183f
commit 51b751a1ee
2 changed files with 21 additions and 7 deletions

View File

@ -16,19 +16,32 @@ class App extends Component {
Hello, Fluencer! Hello, Fluencer!
Thank you for trying Fluence out! Thank you for trying Fluence out!
You can find docs at https://fluence.dev You can find docs at https://fluence.dev
Check out http://dash.fluence.network to deploy your own SQL DB instance Check out http://dash.fluence.network to deploy your own application
Check out https://github.com/fluencelabs/tutorials for more Fluence examples
If you have any questions, feel free to join our Discord https://fluence.chat :) If you have any questions, feel free to join our Discord https://fluence.chat :)
Change 'appId' in 'toggleConnection' method in 'action/messages.js' if needed.
You can send requests to Fluence network straight from console: You can send requests to Fluence network straight from console:
// send the message and don't wait for a response // Create a session to interact with your app
fluenceSession.requestAsync('{"action": "Post", "message": "Hello, Fluence!", "username": "fluencer"}') var session = fluence.directConnect("localhost", 30000);
// get the last message, decode response as a string and print it in the console // Or use current 'fluenceSession'
fluenceSession.request('{"action": "Fetch", "offset": 0, "limit": 1}').then((r) => r.asString()).then(console.log)
// Read data similar to how you've done it in command line,
// except sessionId and counter here are handled automatically
(await fluenceSession.request(\`{"action": "Fetch"}\`)).asString()
// Create new post, and wait for it to appear in UI
await fluenceSession.requestAsync(
\`{"action": "Post", "message": "It's working!", "username": "console_joe"}\`
);
// Note different methods: request and requestAsync. And there's also a query.
// request does write-and-read
// requestAsync only write
// query retrieves result for requestAsync-created request
`) `)
}, 3000); }, 3000);
} }

View File

@ -2,6 +2,7 @@ import * as fluence from "fluence";
let session = fluence.directConnect("localhost", 30000, 1); let session = fluence.directConnect("localhost", 30000, 1);
window.fluenceSession = session; window.fluenceSession = session;
window.fluence = fluence;
export async function changeConnection(devnet, appId) { export async function changeConnection(devnet, appId) {
if (devnet) { if (devnet) {