# WASM & Delphi

**URL:** https://talk.remobjects.com/t/wasm-delphi/20723
**Category:** Oxygene
**Created:** [November 12, 2019, 6:52pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723 "2019-11-12T18:52:27Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![tampatex](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@tampatex](https://talk.remobjects.com/u/tampatex)
#### Post date: [November 12, 2019, 6:52pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/1 "2019-11-12T18:52:28Z")

</div>

I’ve found 2 Samples, Pong & Canvas but they do not run either from my local computer nor when put on a server. The structure seems to be:  
Pong (a Folder)  
index.html  
wasm (sub folder)  
Pong.d.ts  
Pong.js  
Pong.wasm  
RemObjectsElemens.js

The error reported is Pong.wasm not found, failed to load, etc.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [November 12, 2019, 7:04pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/2 "2019-11-12T19:04:37Z")

</div>

Hi

> [@tampatex](#):
>
> I’ve found 2 Samples, Pong & Canvas but they do not run either from my local computer nor when put on a server. The structure seems to be:  
> Pong (a Folder)  
> index.html  
> wasm (sub folder)  
> Pong.d.ts  
> Pong.js  
> Pong.wasm  
> RemObjectsElemens.js

Where did you find these samples, and how are you trying to run them — from the IDE (Fire, Water or Visual Studio), or standalone? What version of Elements are you using?

Does the following docs topic (which explains how all the files should fit together) shed some light onto what might be wrong? Are file relative oaths from the .html to the .js and .wasm files correct, and/or do you see any messages in the debug console?

[http://docs.elementscompiler.com/Platforms/WebAssembly/Deployment/](http://docs.elementscompiler.com/Platforms/WebAssembly/Deployment/)

thanx,  
marc

---

<div class="post-metadata">

### Author: ![tampatex](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@tampatex](https://talk.remobjects.com/u/tampatex)
#### Post date: [November 12, 2019, 7:36pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/3 "2019-11-12T19:36:31Z")

</div>

I don’t have Water or any version of Elements, only copied from GetHub & tried to deploy.  
I don’t really care about these particular samples, but would dearly love to see some Delphi written wasm project sample that runs before I do a trial & spend hrs trying to figure out how it works.

For some reason the \<head . . . /head\> elements & lines did not show, but are in index.html file:

```
	<script lang="javascript" src="wasm/RemObjectsElements.js"></script>
	<script lang="javascript" src="wasm/Pong.js"></script>

```

They came from GetHub(?) as samples I think I got from RemObjects page days ago.  
the index file & the folder layout seems to agree with your link:  
index.html:

 WASM Pong 

```
<body>
<h1>WASM Pong</h1>

<div id="stage" style="width:800px; margin:0 auto;"</div>
<script lang="javascript">
	var program;
	var thetimer;
	var ticks;
	Pong.instantiate("wasm/Pong.wasm").then(function (result) {
   // ***I added the Browser error msg below, not in the index.html file when run***
    // /Pong/wasm/Pong.wasm:1 Failed to load resource:  
    // the server responded with a status of 404 (Not Found)
		console.log("WebAssembly file Pong.wasm has been loaded.");
		program = result.Program();
		program.Main();
	});

```

, , ,

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [November 12, 2019, 8:03pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/4 "2019-11-12T20:03:56Z")

</div>

> [@tampatex](#):
>
> I don’t have Water or any version of Elements, only copied from GetHub & tried to deploy.

Well, for one, you’d there be missing the binary .wasm file, which you’ll only get when you build the project. You’ll need to build the projects with Elements (in the IDE or from the command line) to get the .wasm file.

That said, the document I linked before should explain what relative folders things have to go in on your web server for things to work (note that you cannot load WASM from a local file:// URL — that’s a browser restriction, not ours).

---

<div class="post-metadata">

### Author: ![tampatex](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@tampatex](https://talk.remobjects.com/u/tampatex)
#### Post date: [November 12, 2019, 8:10pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/5 "2019-11-12T20:10:13Z")

</div>

I thought the binary was the Pong.wasm file & it should run on a Server with Pong.wasm in the wasm folder with the js files & below the index.html folder?

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [November 12, 2019, 8:39pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/6 "2019-11-12T20:39:35Z")

</div>

> [@tampatex](#):
>
> I thought the binary was the Pong.wasm

It is, yes.

I’d be able to help you better if I know what the exact sample is you’re looking at and where you got it from. As far as I recall, this is not one in our main samples repro (and if it was, the .wasm binary would not be committed as part of it).

---

<div class="post-metadata">

### Author: ![tampatex](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@tampatex](https://talk.remobjects.com/u/tampatex)
#### Post date: [November 12, 2019, 8:43pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/7 "2019-11-12T20:43:03Z")

</div>

Maybe it would be easiest if you could provide a link to a WASM/Delphi sample with all the files created so & can do nothing more than put on my server & watch it run. Of course with source code so I can figure out how to create my sample more like my project.  
Then, with some confidence of the possibility, I would download the trial cc of Water to proceed to try to build a WASM project sample.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [November 12, 2019, 9:17pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/8 "2019-11-12T21:17:54Z")

</div>

> [@tampatex](#):
>
> Maybe it would be easiest if you could provide a link to a WASM/Delphi sample with all the files created so & can do nothing more than put on my server & watch it run.

Here’s a new project as created from our template, and compiled; the source and binary is included. Once again, check the link I provided before for details how the files need to be deployed relative to each other.

[WasmSample.zip](https://talk.remobjects.com/uploads/short-url/iYwu337gafjCGiDVsk6owLypapr.zip) (1008.7 KB)

> [@tampatex](#):
>
> Then, with some confidence of the possibility, I would download the trial cc of Water to proceed to try to build a WASM project sample.

You’re making yourself a lot more hassle than necessary though, as in Water, you could literally just do File|New project, hit Run, and see it working…

---

<div class="post-metadata">

### Author: ![tampatex](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@tampatex](https://talk.remobjects.com/u/tampatex)
#### Post date: [November 12, 2019, 9:20pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/9 "2019-11-12T21:20:25Z")

</div>

Thanks very much Marc. I’ll look at WasmSample.zip & then download Water & see “how sweet it is”.  
Is this the place for a newbie to get help?

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [November 12, 2019, 9:22pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/10 "2019-11-12T21:22:19Z")

</div>

> [@tampatex](#):
>
> Thanks very much Marc. I’ll look at WasmSample.zip & then download Water & see “how sweet it is”.

👍🏼

> [@](#):
>
> Is this the place for a newbie to get help?

Yes. Aside from the docs site I linked before, and our [blogs](https://blogs.remobjects.com), this here is our main community resource.

—marc

---

<div class="post-metadata">

### Author: ![tampatex](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@tampatex](https://talk.remobjects.com/u/tampatex)
#### Post date: [November 12, 2019, 10:09pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/11 "2019-11-12T22:09:17Z")

</div>

Same Problem. If I can’t deploy your sample I won’t be able to deploy mine.

 ![image](https://talk.remobjects.com/uploads/default/original/2X/9/9eb3196f93e5dff6571461c0d089dfae6f73c8bf.png)

---

<div class="post-metadata">

### Author: ![tampatex](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@tampatex](https://talk.remobjects.com/u/tampatex)
#### Post date: [November 12, 2019, 10:39pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/12 "2019-11-12T22:39:28Z")

</div>

Loaded project files & folders in WebStorm & won’t run with localhost either. Responds with 404.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [November 13, 2019, 12:09am UTC](https://talk.remobjects.com/t/wasm-delphi/20723/13 "2019-11-13T00:09:58Z")

</div>

What server type is this? Sure your server is enabled to serve wasm files? IIS for example only serves a restricted list of files by default. Can you access the wasm file directly by entering its url, or do you get a 404?

I’ll make sure to add a nite about this to our deployment topic tomorrow.

---

<div class="post-metadata">

### Author: ![tampatex](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@tampatex](https://talk.remobjects.com/u/tampatex)
#### Post date: [November 13, 2019, 12:27am UTC](https://talk.remobjects.com/t/wasm-delphi/20723/14 "2019-11-13T00:27:01Z")

</div>

Win Server 2016. I did not know about or do anything to enable WASM. I’m a newbie on Win Server too. I only chose it cuz my previous project needed ISAPI for the speed. It is an AP with much logic & math not suited for JavaScript so separated into Client (HTML/CSS/JS) & Server ISAPI for the hard work. WASM looks so much better as the Client can do the hard stuff making a better Ap. My type of programming is better suited to DeskTop’s not Web stuff, but WASM makes it possible if I can get it to work.  
I probably get a 404. And will check about IIS file type served. That may solve the problem.

---

<div class="post-metadata">

### Author: ![tampatex](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@tampatex](https://talk.remobjects.com/u/tampatex)
#### Post date: [November 13, 2019, 12:44am UTC](https://talk.remobjects.com/t/wasm-delphi/20723/15 "2019-11-13T00:44:32Z")

</div>

It worked after setting mime type: wasm = application/wasm  
You are my HERO! Thanks.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [November 13, 2019, 1:08am UTC](https://talk.remobjects.com/t/wasm-delphi/20723/16 "2019-11-13T01:08:25Z")

</div>

Glad I could help, and sorry for not thinking about this issue earlier - I had hit that myself a few weeks back, but forgot all about it. I’ll make sure we’ll get that documented tomorrow.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [December 2, 2019, 9:42pm UTC](https://talk.remobjects.com/t/wasm-delphi/20723/17 "2019-12-02T21:42:43Z")

</div>

Docs tropic is (was long been) updated btw: [https://docs.elementscompiler.com/Platforms/WebAssembly/Deployment/Web/](https://docs.elementscompiler.com/Platforms/WebAssembly/Deployment/Web/)
