Skip to content

Commit

Permalink
Remove legacy HTTP and websocket (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersjohnsen authored Dec 20, 2021
1 parent fa5da4a commit e6b24c4
Show file tree
Hide file tree
Showing 17 changed files with 70 additions and 1,028 deletions.
9 changes: 9 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

The Toit examples are meant to get you started writing code for an ESP32.

## Packages

Some of the examples use other packages, e.g. HTTP. To run the examples you first need to run:

```
build/host/sdk/bin/toitpkg pkg install
```

in the examples/ folder.

## Licenses

Expand Down
10 changes: 3 additions & 7 deletions examples/http.toit
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ import http

main:
network := net.open

client := http.Client network
host := "www.google.com"
socket := network.tcp_connect host 80

connection := http.Connection socket host
request := connection.new_request "GET" "/"
response := request.send
response := client.get host "/"

bytes := 0
while data := response.read:
while data := response.body.read:
bytes += data.size

print "Read $bytes bytes from http://$host/"
7 changes: 7 additions & 0 deletions examples/package.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
prefixes:
http: pkg-http
packages:
pkg-http:
url: github.com/toitlang/pkg-http
version: 1.4.1
hash: 37f35270669c3249f44a73ad9ea4ccfba7a02164
4 changes: 4 additions & 0 deletions examples/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
http:
url: github.com/toitlang/pkg-http
version: ^1.4.1
Loading

0 comments on commit e6b24c4

Please sign in to comment.