Dynamic Web Development with Seaside

25.4.3Running Remotely

If you want to use Magma in remote server mode you have to execute the following piece of code in a second image. This code launches the server. You have to specify where the repository will be located and the port used for the connection.

MagmaServerConsole new
open: 'todo';
processOn: 51001;

Do not close the inspector since you will use it to send the message shutdown to stop the server. If you accidently close the inspect window you can execute something like this:

MagmaServerConsole allInstancesDo:
[:aServerConsole| aServerConsole shutdown]

To connect to the server, we will have to specify the port and possibly the address. The following methods show how to define a connection to the port 51001 on localhost.

session := MagmaSession
hostAddress: self localhost
port: self defaultPort.
session connectAs: 'user'
^ #(127 0 0 1) asByteArray
^ 51001

We just showed superficially the functionality offered by Magma. Magma offers much more such as optimized and large collections. We suggest you read the documentation of Magma that you can find at: http://wiki.squeak.org/squeak/2665.

Copyright © 21 April 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.