Code Monkey home page Code Monkey logo

Comments (8)

mkmik avatar mkmik commented on September 2, 2024

Hi,

Currently Smart.js has a Websocket client. However it's not hard to implement a websocket server.

It's not clear to me what to do you want exactly. Your code snippet is a html + javascript snippet.

I assume you want to host that HTML on a device running Smart.js, open it on a browser and have your JS code on the user's browser communicate with some code (C or JS?) running on the embedded device. Is that correct?

from mongoose-os.

pastukhov avatar pastukhov commented on September 2, 2024

@mmikulicic Yes, this would be great!

from mongoose-os.

x1project avatar x1project commented on September 2, 2024

For example;
I have server and it has a capability of websocket communication. I want to use my esp8266 as a client and i should able to program with javascript language. This is my basic idea.
I ask that; i can use my browser as a websocket client (i dont know this term is correct or not) to connect my server. When i connect my server (http:// myserver. com:8080/websocket/default.html) my browser interpret javascript code in source code of default.html . I am asking; a esp8266 flashed with smartjs, can i use it same javascript code for connection to my server as a client
My general idea's picture is blow.
so maybe my approach is completely wrong way i dont know but i search, any guidance would be wellcome.
idea

from mongoose-os.

mkmik avatar mkmik commented on September 2, 2024

yes, what you want is a WebSocket client running on your ESP device with Smart.js.

Smart.js does that. You can run JavaScript code on your ESP device. It's practically the same code you'd run on your browser, except the HTML part.

Things like <script type="text/javascript"> are HTML and do not make sense in this context.
They would make sense only if we were talking about files stored on the ESP device and make it act as a HTTP server; but in that case this is not the JavaScript code that would be running on the device.
Does it make sense?


@pastukhov would you mind creating a new issue for tracking your feature request that seems to me unrelated to this ticket ?

from mongoose-os.

x1project avatar x1project commented on September 2, 2024

Smart.js does that. You can run JavaScript code on your ESP device. It's practically the same code you'd run on your browser, except the HTML part.

This sentence is what i want to hear. thanks

from mongoose-os.

mkmik avatar mkmik commented on September 2, 2024

you need to build the firmware with ./make.sh RTOS to enable the WebSocket API.

This SDK is currently less stable than the default (OSS).

from mongoose-os.

alashkin avatar alashkin commented on September 2, 2024

@mmikulicic
Can we close this issue? Does <script type="text/javascript"> work in current FW?

from mongoose-os.

mkmik avatar mkmik commented on September 2, 2024

We currently do support Websocket client API, in both C and JS
We support only Websocket server API in C.

The <script type="text/javascript"> is part of the HTML page that is served by the server (www.myserver.com in the picture), so it has nothing to do with our FW.

Closing

from mongoose-os.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.